SpringBoot的Maven父子项目,一直无法将src/main/resource下面的xml文件打包到target/class西面
在Maven父子项目当中的的搭建了一个SpringBpoot的Web模块工程,项目当中的DAO和Service层的接口和实现类都集成公共基类,但是启动报错
项目结构 包名
system
|-system-modle com.system.model
|-system-common com.system.common
|-system-dao com.system.dao
|-system-dao-common com.system.dao.common mybatis文件 resource/main/mybatis/mapper/common/ *.xml
|-system-dao-user com.system.dao.user mybatis文件 resource/main/mybatis/mapper/user/*.xml
|-system-service com.system.service
|-system-service-common com.system.service.common
|-system-service-user com.system.service.user
|-system-web (springboot项目启动类工程) com.system(本项目的启动类SystemWebApplication就放在咋换个包的下面)
|-system-web-common com.system.web.common
|-system-web-user com.system.web.user
项目启动类
@EnableAutoConfiguration
@SpringBootApplication(
exclude = {DataSourceAutoConfiguration.class})
@ComponentScan(basePackages={"com.system.dao",
"com.system.service", "com.system.web.controller"})
@MapperScan(basePackages={"com.system.dao"})
public class SystemWebApplication {
public static void main(String[] args) {
SpringApplication.run(SystemWebApplication.class, args);
}
}
由于此项目的DAO、Service、Web层接口、配置文件和实现类都在其他工程包下面,所以SpringBoot启动类扫描不到这些代码,
所以,我把com.system.dao,com.system.service,com.system.web.controller这几个包都用@ComponentScan配置了出来,
还有DAO层包还有@MapperScan单独配置了出来
application.yml配置文件
server:
port: 8090
spring:
mvc:
view:
prefix: /jsp/
suffix: .jsp
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/system?useUnicode=true&characterEncoding=UTF-8
username: root
password: 123
type: com.alibaba.druid.pool.DruidDataSource
mybatis:
mapper-locations: classpath:mybatis/mapper/*/*.xml
公共DAO接口
public interface IBasicDao<T> {
public int insert(T obj) throws Exception;
public int batchInsert(List<T> list) throws Exception;
public int delete(T obj) throws Exception;
public int deleteById(@Param(value = "id") int id) throws Exception;
public int batchDelete(Integer[] list) throws Exception;
public int update(T obj) throws Exception;
public int batchUpdate(List<T> list) throws Exception;
public T select(@Param(value = "id") int id) throws Exception;
public List<T> selectAll() throws Exception;
public List<T> selectList(T obj) throws Exception;
public T selectNew() throws Exception;
public List<T> selectNewList(@Param(value = "count") int count) throws Exception;
public int getCount(Map<String, Object> param) throws Exception;
public List<T> getSplitList(Map<String, Object> param) throws Exception;
}
用户信息接口
@Mapper
@Component("userBaseDao")
public interface IUserBaseDao extends IBasicDao<UserInfo> {
}
Service层公共接口
public interface IBaseService<T> {
public int add(T obj) throws LogicException;
public int delete(T obj) throws LogicException;
public int deleteById(int id) throws LogicException;
public int update(T obj) throws LogicException;
public T find(int id) throws LogicException;
public List<T> findAll() throws LogicException;
public List<T> findList(T obj) throws LogicException;
}
Service层公共接口实现类
public class BaseServiceImpl<T, I extends IBasicDao<T>> implements IBaseService<T> {
public I getBasicDao() {
return basicDao;
}
public void setBasicDao(I basicDao) {
this.basicDao = basicDao;
}
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = LogicException.class)
public int add(T obj) throws LogicException {
return basicDao.insert(obj);
}
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = LogicException.class)
public int delete(T obj) throws LogicException {
return basicDao.delete(obj);
}
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = LogicException.class)
public int deleteById(int id) throws LogicException {
return basicDao.deleteById(id);
}
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = LogicException.class)
public int update(T obj) throws LogicException {
return basicDao.update(obj);
}
public T find(int id) throws LogicException {
return basicDao.select(id);
}
public List<T> findAll() throws LogicException {
return basicDao.selectAll();
}
public List<T> findList(T obj) throws LogicException{
return basicDao.selectList(obj);
}
}
用户信息Service层接口
public interface IUserBaseService extends IBaseService<UserBase> {
}
用户信息实现类
@Service("userBaseService")
public class UserBaseServiceImpl extends
BaseServiceImpl<UserBase, IUserBaseDao> implements IUserBaseService {
private Log log = LogFactory.getLog(this.getClass());
@Autowired
@Qualifier("userBaseDao")
private IUserBaseDao userBaseDao;
@Override
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public int add(UserBase user) throws LogicException {
return userBaseDao.insert(user);
}
@Override
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public int delete(UserBase user) throws LogicException {
return userBaseDao.delete(user);
}
@Override
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public int deleteById(int id) throws LogicException {
return userBaseDao.deleteById(id);
}
@Override
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public int update(UserBase user) throws LogicException {
return userBaseDao.update(user);
}
@Override
public UserBase find(int id) throws LogicException {
return userBaseDao.select(id);
}
@Override
public List<UserBase > findAll() throws LogicException {
return userBaseDao.selectAll();
}
@Override
public List<UserBase> findList(UserInfo user) throws LogicException {
return userBaseDao.selectList(user);
}
}
项目启动起来,访问后台菜单DAO接口之后报:
2018-06-28 16:26:28.286 ERROR 4884 --- [nio-8090-exec-3] c.j.s.service.menu.impl.MenuServiceImpl : ********** selectListByUser MenuInfo ERROR ********** Exception = org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.
system.dao.menu.IMenuDao.selectListByUserorg.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.system.dao.menu.IMenuDao.selectListByUser
at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:223)
at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:48)
at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:59)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52)
at com.sun.proxy.$Proxy113.selectListByUser(Unknown Source)
at com.system.service.menu.impl.MenuServiceImpl.findListByUser(MenuServiceImpl.java:240)
at com.system.service.menu.impl.MenuServiceImpl$$FastClassBySpringCGLIB$$fd5aa02f.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:684)
at com.system.service.menu.impl.MenuServiceImpl$$EnhancerBySpringCGLIB$$b68e6a35.findListByUser(<generated>)
at com.system.web.controller.main.MainController.show(MainController.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:877)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:783)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:877)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(Applic
我又把 system-dao-user 和 system-dao-common 这个工程下面的 src/main/resource 的项目配置路径也指定到 target/class 这个文件夹下面了
然后,我又按照网上说的Maven的配置
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/main/resource</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>
之前搭建的普通的Maven项目,配置了这些,都可以将src/main/resource下面的xml文件打包到target/class西面。
不知道Maven父子工程的SpringBoot项目,有什么特别的,为什么无法将src/main/resource下面的xml文件打包到target/class西面。
请高手帮忙看看,这个问题如何解决???
相关推荐
高校及科研院所如何利用外部数据完善技术转移转化机制.docx
科易网基于40亿+科创知识图谱数据库,深度探索AI技术在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,研究科技创新领域的AI+数智化解决方案,推动科技创新与产业创新智能化发展。
完全复现虚拟同步发电机VSG自适应惯量阻尼控制仿真、根轨迹、调节系数对比(Simulink仿真、Matlab代码实现)
内容概要:本文档围绕“【完全复现】虚拟同步发电机VSG自适应惯量阻尼控制仿真、根轨迹、调节系数对比”这一主题,利用Simulink和Matlab平台,系统性地实现了虚拟同步发电机(VSG)的自适应惯量与阻尼控制策略的建模与仿真。内容涵盖VSG的核心控制原理、系统动态响应特性分析、根轨迹绘制以及在不同调节系数下的性能对比研究,旨在深入剖析关键控制参数对系统稳定性与动态性能的影响机制,为新能源并网系统中提升频率支撑能力和暂态稳定性的控制策略设计提供理论依据和技术支持。; 适合人群:具备扎实的电力系统分析与自动控制理论基础,熟练掌握Matlab/Simulink仿真工具,主要从事新能源发电、微电网运行、电力电子变换器控制或电力系统稳定研究的研究生、科研人员及工程技术人员。; 使用场景及目标:①开展虚拟同步发电机(VSG)的建模与先进控制策略的深入研究;②探究自适应惯量与阻尼控制对改善电网频率响应速度和平抑功率波动的作用机理;③运用根轨迹法进行系统稳定性分析,并指导控制器参数的优化整定;④完成高水平学术论文撰写或科研项目申报所需的仿真复现实验。; 阅读建议:本资源以“完全复现”为核心目标,提供了完整的仿真模型与配套代码。使用者应在深入理解同步发电机转子运动方程、虚拟惯量及阻尼物理意义的基础上,结合电力系统暂态稳定理论,逐步操作并调试仿真模型,尤其需关注不同调节系数变化对系统动态性能指标(如超调量、调节时间)的影响,从而深化对VSG内在控制机制与稳定边界的认知。
前端开发基于history.js的HTML5与HTML4浏览器兼容方案:单页应用无刷新历史状态管理技术实现-dQ4ehf7C1792158475
内容概要:本文系统介绍了如何利用history.js实现单页应用(SPA)在HTML5c与HTML4浏览器间s草错发的无缝历史状态管理。通过封装原生History API并在不支持的浏览器中自动降级为哈希路由,history.js解决了因浏览器兼容性导致的后退按钮失效、URL混乱等问题。文章详细讲解了其核心机制,包括状态对象管理、自动模式切换(HTML5 pushState vs HTML4 哈希)、状态数据持久化以及针,对Safari、IE等浏\览器的兼容性修复方案,并提供了从入门到实战的完整示例,涵盖初始化、事,件监听、页面加载及性能优化技巧。;DtPXB1792158476
员工满意度数据集(11列,12000 条记录)CSV 合成
详情介绍:该 HR 员工数据集含 12,000 条 ×11 列(满意度、绩效评估、项目数、月均工时、司龄、工伤、福利包、晋升、部门、薪资),无缺失值但无离职标签列,且存在数据质量问题(141 条负绩效评估、144 条负工时、49.4% 异常高工伤率、项目数仅 0/1/2),疑似经过修改或合成,不能直接做经典的员工离职预测,适合做满意度回归、薪资三分类、晋升预测或员工聚类分析,使用前必须清洗异常值并注意数据真实性限制。
科技服务机构如何通过数据服务增强市场竞争力?.docx
科技服务机构如何通过数据服务增强市场竞争力?


