# Spring 环境
# 建立Common模块
Common模块把Spring boot 通用配置写到这里,包括 Redis,Security,MyBatis-plus等
# 建立Package搜索
在主项目中,不会搜索到这里包下的Bean,进行自动配置
# 加载依赖
dependencies {
implementation("org.springframework.boot:spring-boot-autoconfigure")
}
1
2
3
2
3
# 寻立自动加载Configuration
package com.jingmin.common.configuration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan(basePackages = {"com.jingmin.common"})
public class AutoCommonConfiguration {
}
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
# 建立 spring.factories
在 Common项目中 src/main/resources 目录下建 spring.factories
org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.jingmin.common.configuration.AutoCommonConfiguration
1
← 后端项目搭建