zoukankan      html  css  js  c++  java
  • maven 搭建spring框架报找不到applicationContext-*.xml文件

    问题原因:

    早使用maven搭建web工程时,并没有进行分布式搭建,我是把pojo、dao、service、web 四层直接放在了一个父工程中,并没有一个一个的子工程区分,而是直接打包成了一个war包

    所以在搭建过程中出现了找不到spring的映射文件,web.xml文件报错,

    之后我百度了一下找到了这个配置,由重新执行了一下项目,就执行成功了

    在工程的pom文件中添加以下代码

    <!-- 如果不添加此节点mybatis的mapper.xml文件都会被漏掉。 -->
        <build>
            <resources>
                <!-- 如果不添加此节点mybatis的mapper.xml文件都会被漏掉。 -->
                <resource>
                    <directory>src/main/java</directory>
                    <includes>
                        <include>**/*.properties</include>
                        <include>**/*.xml</include>
                    </includes>
                    <filtering>false</filtering>
                </resource>
                <resource>
                    <directory>src/main/resources</directory>
                    <includes>
                        <include>**/*.properties</include>
                        <include>**/*.xml</include>
                    </includes>
                    <filtering>false</filtering>
                </resource>
            </resources>
    
            <!-- 添加tomcat插件 -->
            <plugins>
                <plugin>
                    <groupId>org.apache.tomcat.maven</groupId>
                    <artifactId>tomcat7-maven-plugin</artifactId>
                    <configuration>
                        <port>8081</port>
                        <path>/</path>
                    </configuration>
                </plugin>
            </plugins>
        </build>
  • 相关阅读:
    课堂练习求环整数组中最大子数组之和
    学习进度第7周
    声明
    最大数
    学习进度02
    构建之法阅读笔记02
    学习进度01
    课堂练习之《哈利波特》
    《构建之法》阅读笔记06
    寻找水龙王2
  • 原文地址:https://www.cnblogs.com/yaowan/p/8984699.html
Copyright © 2011-2022 走看看