Spring Boot项目pom
程序员文章站
2022-04-26 09:18:27
...
spring boot web
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
spring boot thymeleaf
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
简单配置
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.encoding=utf-8
spring boot mybatis
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.4</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
简单配置
mybatis.mapper-locations=classpath:mapping/*.xml
mybatis.type-aliases-package=com.example.d5.demo.mapper
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.username=fabu
spring.datasource.password=73R4_h8td6fE
spring.datasource.url=jdbc:mysql://10.47.187.205:3306/gulimall_pms
@ComponentScan(basePackages = {"com.example"})
@MapperScan("com.example.d5.demo.mapper")
@SpringBootApplication
public class DemoApplication {
mybatis-plus
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.2</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
简单配置
spring:
datasource:
username: root
password: root
url: jdbc:mysql://192.168.56.10:3306/gulimall_oms
driver-class-name: com.mysql.jdbc.Driver
mybatis-plus:
mapper-locations: classpath:/mapper/**/*.xml
global-config:
db-config:
id-type: auto
mybatis-plus 引入分页插件
@Configuration
@EnableTransactionManagement //开启事务
@MapperScan("com.atguigu.gulimall.product.dao")
public class MyBatisConfig {
//引入分页插件
@Bean
public PaginationInterceptor paginationInterceptor() {
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
// 设置请求的页面大于最大页后操作, true调回到首页,false 继续请求 默认false
paginationInterceptor.setOverflow(true);
// 设置最大单页限制数量,默认 500 条,-1 不受限制
paginationInterceptor.setLimit(1000);
return paginationInterceptor;
}
}
上一篇: CentOS7.6上使用docker harbor管理私有仓库
下一篇: 可以用葡萄做雪媚娘吗
推荐阅读
-
使用Spring Boot和AspectJ实现方法跟踪基础结构
-
SpringBoot 源码解析 (三)----- Spring Boot 精髓:启动时初始化数据
-
idea创建一个入门Spring Boot项目(controller层)使用Moven代码管理
-
Spring Boot引入依赖包Druid
-
Spring Boot 开发个人博客--后台登录
-
将spring boot部署到tomcat上
-
Spring Boot面试题(2020最新版)
-
解决spring boot1.5以上版本@ConfigurationProperties提示“Spring Boot Configuration Annotation Processor not.."
-
什么是Spring Boot
-
Spring-Boot 集成Solr客户端的详细步骤