我已經在內部開發Maven插件(可以稱之爲一個),使用Spring IoC容器和Maven項目(稱之爲乙)使用這個插件。導入系統屬性Maven插件的Spring上下文
我想指定B的pom.xml的特定插件配置,所以這個屬性會在插件的Spring上下文來訪問
我希望這樣的事情, pom.xml的(項目乙)
<plugin>
...
<configuration>
<dummyproperty>dummy_value</dummyproperty>
</configuration>
...
</plugin>
Spring_context.xml(項目一個 - 插件)
<bean class="com.blabla.SomeClass">
<property name="someBeanProperty" value="${dummyproperty}" />
</bean>
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
我已經嘗試過使用插件配置的各種方法,額外的屬性文件,但春天的上下文中的佔位符沒有得到填充真正的值。 提前
不應該使用Maven的內置IOC容器Plexus而不是Spring嗎? Plexus與Maven緊密集成。只需將'@parameter expression =「$ {dummyproperty}」'放置在屬性的setter的javadoc中即可訪問系統屬性。 – 2010-06-08 17:07:08
@ abhin4v:同意。甚至還有一個叢 - 春天的「橋」,允許在Plexus中重複使用彈簧豆。 – 2010-06-09 09:32:58