springboot集成
难丿书
这个作者很懒,什么都没留下…
展开
-
spring boot2.0 集成jsp
手动添加依赖springboot不建议大家使用jsp(推荐使用 thymeleaf),所以需要手动添加依赖pom.xml <!-- 添加 servlet 依赖. --> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId>原创 2020-11-24 15:55:01 · 199 阅读 · 0 评论 -
spring boot2.0 集成SpringMVC
修改SpringMVC端口、地址application.propertiesserver.port=8099server.servlet.context-path=/web01设置配置项(前缀+类变量名)到application配置文件中整合SpringMVC静态资源http://localhost:8099/web01/js/jquery-2.2.3.min.js(1)static目录的作用是什么?类型webapp,存放静态资源的,如css,js,image该目录下的资源可以直接原创 2020-11-24 15:33:21 · 108 阅读 · 0 评论 -
spring boot2.0 集成thymeleaf
Thymeleaf介绍(1)什么事模板技术?由模板引擎数据与模板页面结合在一起,形成页面(2)什么是thymeleaf?spring boot并不推荐使用jsp,但是支持一些模板引擎技术,如:Freemarker,Thymleaf,Mustache(3)为什么选择Thymeleaf可以完全代替jsp(4)有什么特点》动静结合,直接访问或者通过服务器访问浏览器解释 html 时会忽略未定义的标签属性,所以 thymeleaf 的模板可以静态地运行当有数据返回到页面时,Thymeleaf原创 2020-11-24 15:07:51 · 102 阅读 · 0 评论 -
spring boot2.0集成Redis
添加依赖配置application.propertiesspring.redis.host=localhostspring.redis.port=6379测试@SpringBootTestclass Demo06redisApplicationTests { @Autowired RedisTemplate<String, String> rt; @Test void test01() { //查找是否有缓存原创 2020-11-24 11:19:29 · 84 阅读 · 0 评论 -
spring boot2.0集成jpa
添加依赖配置application.yml文件spring: datasource: # hikari driver-class-name: com.mysql.cj.jdbc.Driver # mysql 8 username: root password: url: jdbc:mysql://localhost:3306/springboot_test?useUnicode=true&characterEncoding=utf8&serverT原创 2020-11-24 11:03:10 · 78 阅读 · 0 评论 -
spring boot2.0集成mybatis
新建选择spring Initializr,选择mysql驱动和mybatis框架。测试准备数据库,创建user表,随便输入数据。create database springboot_test;create table person( id int primary key auto_increment, name varchar(20), age int)domain下Person类,需要get、set、无参方法和打印public class Person {原创 2020-11-23 21:01:04 · 158 阅读 · 1 评论 -
spring boot2.0 hikari数据库连接池
hikari数据库连接池介绍(1)hikari 光(日本地名,hikari日本开发的)(2)hikariCP是现在比较快,而且轻量级的连接池(3)hikari的特点1.Hikari是一款非常强大,高效,并且号称“史上最快连接池”2.在springboot2.0之后,采用的默认数据库连接池就是Hikari。不需要引入依赖,已经在SpringBoot中包含了。3.GitHub地址:https://github.com/brettwooldridge/HikariCP和其他连接池对比图创建原创 2020-11-23 20:37:05 · 715 阅读 · 0 评论 -
Spring boot2.0集成Junit
springboot集成Junit5创建以前使用junit4现在,springboot 2.4 自动使用junit5使用springboot创建就完成集成Junit5测试编写一个全查接口和实现类,使用Junit5测试service接口:public interface IPersonService { void savePerson();}实现类impl:@Servicepublic class PersonServiceImpl implements IPersonSer原创 2020-11-23 19:47:59 · 246 阅读 · 0 评论