背景:
我们开发bi组件,作为公共产品,其中包含数据包,图表,图册对应的功能接口。
包含mvc一套
而后续为了推广到各个省份,但是bi工具平台依然在更新功能,那么这里以jar包引入到其他业务省份。
1. 在pom中引入bi产品项目
<dependency>
<groupId>com.boco.mpss</groupId>
<artifactId>MPSS-BI</artifactId>
<version>${project.version}</version>
</dependency>
2. 在application启动类增加注解
@ComponentScan(basePackages = {
"com.boco" })
这样就可以访问controller了、
3. 但是我在测试的时候发现访问mybatis的时候,报错org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.boco.wbs.function.custom.dao.CustomMapper.getAddress
找不到对应的xml
解决方案:
修改yml配置文件
修改前是这样写的读本地xml
mybatis:
configuration:
aggressive-lazy-loading: 'false'
cache-enabled: 'true'
default-executor-type: REUSE
default-statement-timeout: 25000
lazy-loading-enabled: 'false'
multiple-result-sets-enabled: 'true'
call-setters-on-nulls: true
mapper-locations: classpath:mybatis/*.xml -- 这里是这样读取本地
修改后可以读到jar中
mapper-locations: classpath*:mybatis/*.xml
在classpath后面增加 * 就可以了