项目里有个和SRC目录同级的config目录·所有hibernate struts spring配置文件都放在config目录
那是怎么实现的

解决方案 »

  1.   

    在web.xml修改配置即可..........
      

  2.   

    web.xml配置struts:
    <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>
    org.apache.struts.action.ActionServlet
    </servlet-class>
    <init-param>
    <param-name>config</param-name>
    <param-value>
    /WEB-INF/classes/com/config/XXX-config.xml,
    </param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
    </servlet>web.xml配置spring:
    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
    /WEB-INF/classes/com/config/XXXXXContext.xml
    </param-value>
    </context-param>
    spring配置Hibernate:
    <property name="mappingResources">
    <list>
    <value>com/config/User.hbm.xml</value>
    </list>
    </property>
    总而言之加上路径/WEB-INF/classes/XXX/XXX随便位置
      

  3.   

    ant或maven构建的目录结构中有一个配置文件,<module>目录名</module>
    <?xml version="1.0" encoding="ISO-8859-1"?><!--
      Licensed to the Apache Software Foundation (ASF) under one
      or more contributor license agreements.  See the NOTICE file
      distributed with this work for additional information
      regarding copyright ownership.  The ASF licenses this file
      to you under the Apache License, Version 2.0 (the
      "License"); you may not use this file except in compliance
      with the License.  You may obtain a copy of the License at
      
      http://www.apache.org/licenses/LICENSE-2.0
      
      Unless required by applicable law or agreed to in writing,
      software distributed under the License is distributed on an
      "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
      KIND, either express or implied.  See the License for the
      specific language governing permissions and limitations
      under the License.
    --><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <parent>
        <groupId>org.apache</groupId>
        <artifactId>apache</artifactId>
        <version>4</version>
      </parent>
      <organization>
        <name>Apache MINA Project</name>
        <url>http://mina.apache.org/</url>
      </organization>
      <groupId>org.apache.mina</groupId>
      <version>2.0.0-RC1</version>
      <artifactId>build</artifactId>
      <name>Apache MINA</name>
      <packaging>pom</packaging>  <url>http://mina.apache.org/</url>
      <inceptionYear>2004</inceptionYear>  <issueManagement>
        <system>jira</system>
        <url>http://issues.apache.org/jira/browse/DIRMINA</url>
      </issueManagement>  <scm>
        <connection>scm:svn:http://svn.apache.org/repos/asf/mina/tags/2.0.0-RC1</connection>
        <url>http://svn.apache.org/viewvc/directory/mina/tags/2.0.0-RC1</url>
        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/mina/tags/2.0.0-RC1</developerConnection>
      </scm>  <distributionManagement>
        <site>
          <id>apache.websites</id>
          <url>scp://people.apache.org/www/mina.apache.org/report/trunk/</url>
        </site>
      </distributionManagement>  <ciManagement>
        <notifiers>
          <notifier>
            <type>mail</type>
            <address>[email protected]</address>
          </notifier>
        </notifiers>
      </ciManagement>  <description>Apache MINA is a network application framework which helps users develop high performance and highly scalable network applications easily.  It provides an abstract event-driven asynchronous API over various transports such as TCP/IP and UDP/IP via Java NIO.</description>  <licenses>
        <license>
          <name>Apache 2.0 License</name>
          <url>http://www.apache.org/licenses/LICENSE-2.0</url>
          <distribution>repo</distribution>
        </license>
      </licenses>
      <modules>
        <module>legal</module>
        <module>parent</module>
        <module>core</module>
        <module>transport-apr</module>
        <module>filter-compression</module>
        <module>statemachine</module>
        <module>integration-beans</module>
        <module>integration-xbean</module>
        <module>integration-ognl</module>
        <module>integration-jmx</module>
        <module>example</module>
      </modules>  <profiles>
        <profile>
          <id>default</id>
        </profile>
        <profile>
          <id>serial</id>
          <activation>
            <property>
              <name>with-LGPL-dependencies</name>
            </property>
          </activation>
          <modules>
            <module>transport-serial</module>
          </modules>
        </profile>
      </profiles>
      
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.0.2</version>
            <configuration>
              <encoding>UTF-8</encoding>
              <source>1.5</source>
              <target>1.5</target>
              <debug>true</debug>
              <optimize>true</optimize>
              <showDeprecations>true</showDeprecations>
            </configuration>
          </plugin>      <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.4.3</version>
            <configuration>
              <excludes>
                <exclude>**/Abstract*</exclude>
                <exclude>**/*RegressionTest*</exclude>
              </excludes>
            </configuration>
          </plugin>      <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>2.0.4</version>
            <executions>
              <execution>
                <id>attach-source</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>      <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.2-beta-3</version>
            <configuration>
              <descriptors>
                <descriptor>release.xml</descriptor>
              </descriptors>
              <finalName>mina-${pom.version}</finalName>
              <appendAssemblyId>false</appendAssemblyId>
              <tarLongFileMode>gnu</tarLongFileMode>
            </configuration>
          </plugin>      <plugin>
            <artifactId>maven-release-plugin</artifactId>
            <version>2.0-beta-7</version>
            <configuration>
              <tagBase>
                https://svn.apache.org/repos/asf/mina/tags
              </tagBase>
            </configuration>
          </plugin>      <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <version>1.4.1</version>
            <inherited>true</inherited>
            <extensions>true</extensions>
            <configuration>
              <instructions>
                <Bundle-SymbolicName>${symbolicName}</Bundle-SymbolicName>
                <Export-Package>${exportedPackage}.*;version=${pom.version}</Export-Package>
              </instructions>
            </configuration>
          </plugin>
        </plugins>
      </build>  <reporting>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.4</version>
            <inherited>false</inherited>
            <configuration>
              <aggregate>true</aggregate>
              <breakiterator>true</breakiterator>
              <charset>UTF-8</charset>
              <docencoding>UTF-8</docencoding>
              <windowtitle>Apache MINA ${project.version} API Documentation</windowtitle>
              <doctitle>Apache MINA ${project.version} API Documentation</doctitle>
              <encoding>UTF-8</encoding>
              <excludePackageNames>*.example.*</excludePackageNames>
              <links>
                <link>http://java.sun.com/j2se/1.5.0/docs/api/</link>
                <link>http://www.slf4j.org/api/</link>
                <link>http://static.springframework.org/spring/docs/2.0.x/api/</link>
                <link>http://dcl.mathcs.emory.edu/util/backport-util-concurrent/doc/api/</link>
              </links>
              <locale>en_US</locale>
            </configuration>
          </plugin>      <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jxr-plugin</artifactId>
            <version>2.1</version>
            <inherited>false</inherited>
            <configuration>
              <aggregate>true</aggregate>
              <inputEncoding>UTF-8</inputEncoding>
              <outputEncoding>UTF-8</outputEncoding>
              <windowTitle>Apache MINA ${project.version} Cross Reference</windowTitle>
              <docTitle>Apache MINA ${project.version} Cross Reference</docTitle>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>rat-maven-plugin</artifactId>
            <version>1.0-alpha-3</version>
            <configuration>
              <excludes>
                <exclude>**/target/**/*</exclude>
                <exclude>**/.*</exclude>
                <exclude>**/NOTICE.txt</exclude>
                <exclude>**/LICENSE*.txt</exclude>
              </excludes>
              <excludeSubProjects>false</excludeSubProjects>
            </configuration>
          </plugin>
        </plugins>
      </reporting>
    </project>