pom.xml
支持springBoot
parent
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.1</version>
</parent>
starter
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
支持springWeb
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
支持mybatis【TODO】
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<!--不知道為什么,去了版本就不支持MapperScan注解-->
<version>1.3.0</version>
</dependency>
<!-- mysql 數(shù)據(jù)庫(kù)驅(qū)動(dòng). -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
支持aop
<!-- SpringBoot 攔截器 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
properties或者yml常用配置
服務(wù)端口
視圖前后綴配置
spring:
mvc:
view:
prefix: /WEB-INF/views
suffix: .jsp
數(shù)據(jù)庫(kù)yml【todo】
spring:
datasource:
# 使用druid數(shù)據(jù)源
type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://localhost:3306/test21.2.27?serverTimezone=UTC
username: root
password: 123456
driver-class-name: com.mysql.jdbc.Driver
filters: stat
maxActive: 20
initialSize: 1
maxWait: 60000
minIdle: 1
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: select 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20