• [JAVA] springboot中整合Redis的详细讲解 日期:2021/4/2 15:18:00点击:988来源:互联网

    springboot整合Redis1、添加依赖<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId></dependency>2、配置application.yml3、注入模板对象@RunWith(SpringRunner.class)@SpringBootTestclass SpringbootRedisApplicationTests { @Autowired private RedisTemplate redisTemplate; @PostConstruct public void init(){ //配置St...

  • [JAVA] Springboot/Java读取文件 日期:2021/4/2 15:14:00点击:1002来源:互联网

    ====工程结构图///java属性和加载器// /** * 当测试类在 com.spt.example 下 * getResourceAsStream("test.txt") 会从com.spt.example包下开始找test.txt * getResourceAsStream("/test.txt") 会从classpath根下开始找test.txt */ this.getClass().getClassLoader().getResourceAsStream("test.txt"); /** * 不在乎是否/test.txt 或者test.txt 都会从classpath根下找 */ ClassLoader.getSystemReso...

  • [JAVA] SpringBoot实现文件上传 日期:2021/4/2 13:47:00点击:870来源:互联网

    后端上传代码如下package com.mouday.demo.controller;import org.springframework.stereotype.Controller;import org.springframework.util.ResourceUtils;import org.springframework.web.bind.annotation.GetMapping;import org.springframework.web.bind.annotation.PostMapping;import org.springframework.web.bind.annotation.RequestParam;import org.springframework.web.bind.annotation.ResponseBody;import org.sprin...

  • [JAVA] 搜索技术---solr 日期:2017/8/29 17:05:00点击:1964来源:互联网

    企业站内搜索技术选型在一些大型门户网站、电子商务网站等都需要站内搜索功能,使用传统的数据库查询方式实现搜索无法满足一些高级的搜索需求,比如:搜索速度要快、搜索结果按相关度排序、搜索内容格式不固定等,这里就需要使用全文检索技术实现搜索功能。单独使用Lucene实现单独使用Lucene实现站内搜索需要开发的工作量较大,主要表现在:索引维护、索引性能优化、搜索性能优化等,因此不建议采用。使用Google或Baidu接口通过第三方搜索引擎提...

  • [JAVA] Druid 介绍及详细配置 日期:2017/8/29 15:41:00点击:1878来源:互联网

    Druid 介绍及配置1. Druid是什么?Druid是Java语言中最好的数据库连接池。Druid能够提供强大的监控和扩展功能。2. 在哪里下载druid正式版本下载:maven中央仓库:http://central.maven.org/maven2/com/alibaba/druid/3. 怎么获取Druid的源码Druid是一个开源项目,源码托管在github上,源代码仓库地址是https://github.com/alibaba/druid。同时每次Druid发布正式版本和快照的时候,都会把源码打包,你可以从上面的下载地址中找到相关版本的源...

  • [JAVA] Spring boot 使用Thymeleaf对web视图进行渲染 日期:2017/8/17 15:21:00点击:2381来源:互联网

    ThymeleafThymeleaf是一个XML/XHTML/HTML5模板引擎,可用于Web与非Web环境中的应用开发。也就是说它即可以在在浏览器查看页面的静态效果,也可以在服务器查看带数据的动态页面效果。基本配置build.gradle配置"org.springframework.boot:spring-boot-starter-thymeleaf"11application.properties配置spring.thymeleaf.cache=false spring.thymeleaf.check-template=true spring.thymeleaf.content-type=text/html spring.thy...

  • [JAVA] Spring MVC中使用Thymeleaf模板引擎 日期:2017/8/17 15:10:00点击:1857来源:互联网

    新一代Java模板引擎Thymeleaf一定让你惊叹于Thymeleaf的强大,但是真正在Web应用结合Web特性使用模板引擎,还需要进行一定的配置和学习。Thymeleaf于Spring集成Thymeleaf除了基本的模板引擎,还提供了一套Spring集成技术使得在Spring MVC中能够使用它完全替代JSP作为模板引擎,它的功能特性如下:Spring MVC中@Controller中的方法可以直接返回模板名称,接下来Thymeleaf模板引擎会自动进行渲染模板中的表达式支持Spring表达式语言(Spring...

  • [JAVA] spring boot热部署,使用devtools,更新任务内容不需要重启服务 日期:2017/8/17 15:01:00点击:1904来源:互联网

    如果不使用devtools,我们对类的任何修改都需要重启服务才能看到效果,这是不是很操蛋,现在介绍一个如果实现热部署的方法1:pom.xml中增加<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> <scope>true</scope></dependency>2:pom.xml中增加以下插件<plugin> <groupId>...

Copyright © 2005 - 2016 flyso.cn. 飞搜 版权所有 鄂ICP备11002783号-3