spring mvc+mybatis+dbcp+maven多模块项目的搭建遇到的问题(三)

出现问题:打包了parent主项目之后,web模块的配置文件:spring-*.xml 和数据库配置文件和mybatis文件找不到


25-May-2018 13:02:11.248 SEVERE [http-nio-8080-exec-2] org.springframework.web.servlet.DispatcherServlet.initServletBean Context initialization failed
 org.springframework.beans.factory.BeanDefinitionStoreException: Could not resolve bean definition resource pattern [classpath:spring/spring-*.xml]; nested exception is java.io.FileNotFoundException: class path resource [spring/] cannot be resolved to URL because it does not exist

现在项目有了数据库 有了其他模块,不知道之前单独打包web模块的还是什么,就当时的打包不需要其他模块的事情,所以网上找了好多,不怎么找得到关于多模块打包的详细介绍,找到一些关于那个build的resource配置。

最终项目配置是这样的:

主项目的pom.xml


web模块(module)的pom.xml



service模块的pom.xml


handler层是数据库连接   没什么重要的。

为了让实体类注入的时候,js写的方便一点,在handler的实体类里面加了一个注解,以前没有用过,为了这种形式的时间能注入到实体类中。实体类放在handler是为了公用。

打包的时候使用maven的方法打包

打开view里面的tool button然后选择右边栏的maven project 选择了web的module进行了打包


最后生成的war包直接放进Tomcat的webapps下就可以访问了

猜你喜欢

转载自blog.csdn.net/searlas/article/details/80450478