版权声明:转载请注明出处 https://blog.csdn.net/ID1012/article/details/84132241
1.编写application.yml配置文件
#SpringBoot启动端口和项目路径
server:
port: 8080
context-path: /
#SpringMVC中JSP视图配置
spring:
mvc:
view:
prefix: /WEB-INF/views/
suffix: .jsp
#数据源配置
datasource:
name: w1
url: jdbc:mysql://127.0.0.1:3306/ssm?useUnicode=true&characterEncoding=utf8
username: root
password: root
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
maxActive: 20
initialSize: 1
maxWait: 60000
minIdle: 1
#Http编码配置
http:
encoding:
force: true
charset: UTF-8
enabled: true
#Rabbitmq消息服务器配置
rabbitmq:
host: 127.0.0.1
port: 5672
username: guest
password: guest
virtual-host: /
# Redis数据库索引(默认为0)
redis:
database: 0
host: 192.168.232.128
port: 6379
password: redis
pool.max-active: 8
pool.max-wait: -1
pool.max-idle: 8
pool.min-idle: 0
timeout: 0
#Solr配置
data:
solr:
host: http://localhost:8984/solr/new_core
#Mybatis实体类配置
mybatis:
mapper-locations: classpath:mapper/*.xml
#pagehelper分页插件
pagehelper:
helperDialect: mysql
reasonable: true
#日志配置
logging:
file: d:/springboot.log
level:
com.test.mapper: DEBUG
2.在pom.xml中加入以下依赖
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jsp-api</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.7.5</version>
</dependency>