이 문제에 관해서는 SO question and answers이 좋지만 이러한 옵션은 제대로 작동하지 않습니다.Maven settings.xml 파일에서 응용 프로그램 컨텍스트로 속성 가져 오기
<bean class="blah.blah.Blah" id="blah">
<property name="first" value="${first.property}"/>
<property name="second" value="${second.property}"/>
</bean>
나는 메이븐의 settings.xml
파일에 다음과 같은 한 :
내가 응용 프로그램 컨텍스트 변수를 전달하려면
<profiles>
<profile>
<id>profileId</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<first.property>first value</first.property>
<second.property>second value</second.property>
</properties>
내가 (약간 이상이다) this option 시도를, 그것을 준 결과가 없습니다. 나는이 플러그인을 추가하는 것보다 :
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>write-project-properties</goal>
</goals>
<configuration>
<outputFile>
src/main/resources/maven.properties
</outputFile>
</configuration>
</execution>
</executions>
</plugin>
을 그리고 프로젝트의 모든 maven.properties
파일은 이후 없었다. 빈 파일을 만들면 아무 것도 나타나지 않습니다. 그리고 -PprofileId
으로 이러한 단계를 반복하려고 시도했지만 도움이되지 않았습니다. 누군가가 작동하는 코드 스 니펫을 제공하거나 내가 여기에서 무엇을 놓칠 수 있는지 말해 줄 수 있습니까? 미리 감사드립니다.
업데이트 : 내가 틀렸어 properties-maven-plugin
이 잘 동작합니다.
어디 applicationContext.xml 정확히'src/main/resources' 또는'src/main/java' 아래에 있습니까? – yorkw
@yorkw src/main/resources 아래에 있습니다. 괜찮나요? –