基本架构图
代码结构图
说明
soar-parent :soar项目的顶级包
soar-common :soar项目的公共资源包
soar-module :soar项目的前端模块包的父包
soar-starter :soar项目的启动入口
重要点
## 在Application.java类中配置注解扫描
“` java
@SpringBootApplication(scanBasePackages= {“com.heng.soar”})
@MapperScan(basePackages = “com.heng.soar.*.mapper”)
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
soar-module中的包名需要是以`com.heng.soar`开头
mapper接口的包名需要符合`com.heng.soar.*.mapper的`格式
在soar-starter中的`application.propeties`文件中配置
`mybatis.mapper-locations=classpath*:mapper/*.xml`
`classpath*`表示会扫描当前项目及其引用jar包的classpath下的文件
在soar-common的pom文件中加入
``` java
<dependency>
<groupId>com.heng.soar</groupId>
<artifactId>soar-module-core</artifactId>
<version>${parent.version}</version>
</dependency>
表示项目启动后加载soar-module-core模块的功能