Spring Boot MySQL配置:
- MySql配置
application.properties文件
#数据库参数配置
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/test
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.max-idle=10
spring.datasource.max-wait=10000
spring.datasource.min-idle=5
spring.datasource.initial-size=5
- tomcat服务器配置
application.properties文件
#端口号设置
server.port=8011
#session超时时间(分钟)
server.session.timeout=30
#编码 解决后台传数据到前台,中文乱码的问题
server.tomcat.uri-encoding=UTF-8
- 项目热部署(修改代码之后自动部署,不需重启服务)
pom.xml文件
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
- 跳转html页面
pom.xml文件
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
注:官方推荐使用thymeleaf,freemarker等模版引擎,不推荐jsp的支持(为什么不推荐使用jsp呢,或者说为什么舍弃掉jsp呢)