Spring+Maven 如何加载properties配置文件

在pom.xml文件中添加如下内容:
  <build>
    <finalName>coresearchengine</finalName>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.1</version>
        <executions>
          <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>src/main/resources</source>
                <source>src/main/java</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

在spring配置文件中加载properties文件:

猜你喜欢

转载自annel-xiaoshixiang.iteye.com/blog/2079735