maven 多模块不同域名
场景,在不改变 父项目的包名下,开发不同域名的子项目注: groupId 与所取的包名无关例如: 父级域名 : ruoyi.com父级或者其他代码都在包com.ruoyi 下:字模块域名 : suimu.site子模块的代码都在包 :site.suimu 下Spring boot 项目:yml 配置 :# 搜索指定包别名(site 无法配置,我放弃了,新建原域名下的模块,把 domain 类都放进
·
场景,在不改变 父项目的包名下,开发不同域名的子项目
报错
Invalid bound statement (not found):
Description:
Field helloService in com.ruoyi.test.controller.HelloController required a bean of type 'site.suimu.re.mapper.HelloMapper' that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type 'site.suimu.re.mapper.HelloMapper' in your configuration.
注: groupId 与所取的包名无关
例如: 父级域名 : ruoyi.com
父级或者其他代码都在包 com.ruoyi 下:
字模块域名 : suimu.site
子模块的代码都在包 : site.suimu 下
Spring boot 项目:
yml 配置 :
# 搜索指定包别名(site 无法配置,我放弃了,新建原域名下的模块,把 domain 类都放进去)
typeAliasesPackage: com.
# 配置mapper的扫描,找到所有的mapper.xml映射文件
mapperLocations: classpath*:mapper/**/*Mapper.xml
启动器代码:
package com.ruoyi;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
/**
* 启动程序
*
* @author ruoyi
*/
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
// service 扫描
@ComponentScan({ "com.ruoyi.**","site.suimu.**" })
// mapper 扫描
@MapperScan({ "com.ruoyi.*.mapper","site.suimu.*.mapper"})
public class RuoYiApplication
{
public static void main(String[] args)
{
SpringApplication.run(RuoYiApplication.class, args);
}
}
更多推荐
已为社区贡献1条内容
所有评论(0)