关于springboot:SpringBoot项目依赖注入92之前

6次阅读

共计 1253 个字符,预计需要花费 4 分钟才能阅读完成。

SpringBoot 我的项目依赖注入
1.Mysql Driver
2.JDBC API
3. 增加 Mybatis 依赖:

    <dependency>
                    <groupId>org.mybatis.spring.boot</groupId>
                    <artifactId>mybatis-spring-boot-starter</artifactId>
                    <version>2.1.3</version>
    </dependency>
* 配置:mybatis.configuration.default-statement-timeout=30    
    mybatis.configuration.map-underscore-to-camel-case=true
    日志输入:logging.level.com.cy=DEBUG

4.Spring MVC 依赖:

Web 依赖:会配置一个内置的 tomcat
<dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
</dependency>
Thymeleaf 依赖:<dependency>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
* 配置 Thymeleaf 的地址:spring.thymeleaf.prefix=classpath:/templates/pages/
spring.thymeleaf.suffix=.html

5. 配置文件:

spring.main.banner-mode=off

spring.datasource.url=jdbc:mysql://localhost:3306/dbgoods?serverTimezone=GMT%2B8&characterEncoding=utf-8
spring.datasource.username=root
spring.datasource.password=root

spring mybatis

mybatis.mapper-locations=classpath:/mapper/goods/*.xml

Spring log

logging.level.com.py=debug

SpingMVC Tomcat:port

server.port=80
server.servlet.context-path=/

Spring thymeleaf config

spring.thymeleaf.cache=false
spring.thymeleaf.prefix=classpath:/templates/pages/
spring.thymeleaf.suffix=.html

management.endpoints.web.exposure.include=*

正文完
 0