为了更好地反映我的问题,我稍微修改了我的原始问题。我有一个非Spring Boot应用程序,我希望与Spring Cloud Config Server一起工作。我在网上搜索并尝试了很多东西,但似乎我的问题的关键是服务器只能在Spring Boot环境中使用。虽然ActiveMQ已经是一个Spring应用程序,但将它转换为Spring Boot应用程序似乎并不重要。获取非Spring Boot程序(如ActiveMQ)与Spring Cloud Config配合使用
我想要一个从Spring Cloud Config配置的ActiveMQ Broker
。我在application.properties中的本地设置应该被来自服务器的设置取代。这适用于我工作的其他服务器,现在我需要它为我的Broker Filter插件工作。
我增加了以下内容activemq.xml中:
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:application.properties</value>
<value>file:${activemq.conf}/credentials.properties</value>
</list>
</property>
</bean>
NOTE: Several base packages omitted here but are similar to:
<context:component-scan base-package="org.springframework.cloud.bootstrap"/>
<!-- enables annotation based configuration -->
<context:annotation-config />
这样做我能得到各种@Value
注解与设置,从我application.properties来,但整个Spring Cloud Config Server
事情似乎不能代替工作后我的本地application.properties文件设置。我工作的其他Spring Boot应用程序这样做我知道服务器是好的。
我已经添加了以下jar添加到Apache的ActiveMQ的-5.12.0 \ LIB \ extra目录:
spring-aop-4.1.8.RELEASE.jar
spring-beans-4.1.8.RELEASE.jar
spring-boot-1.2.7.RELEASE.jar
spring-boot-actuator-1.2.7.RELEASE.jar
spring-boot-autoconfigure-1.2.7.RELEASE.jar
spring-boot-starter-1.2.7.RELEASE.jar
spring-boot-starter-actuator-1.2.7.RELEASE.jar
spring-boot-starter-data-mongodb-1.2.7.RELEASE.jar
spring-boot-starter-logging-1.2.7.RELEASE.jar
spring-cloud-commons-1.0.1.RELEASE.jar
spring-cloud-config-client-1.0.1.RELEASE.jar
spring-cloud-context-1.0.1.RELEASE.jar
spring-cloud-starter-1.0.1.RELEASE.jar
spring-cloud-starter-config-1.0.1.RELEASE.jar
spring-context-4.1.8.RELEASE.jar
spring-context-support-4.1.8.RELEASE.jar
spring-core-4.1.8.RELEASE.jar
spring-data-commons-1.11.0.RELEASE.jar
spring-data-mongodb-1.8.0.RELEASE.jar
spring-expression-4.1.8.RELEASE.jar
spring-jms-4.1.8.RELEASE.jar
spring-security-crypto-3.2.8.RELEASE.jar
spring-test-4.1.8.RELEASE.jar
spring-tx-4.1.8.RELEASE.jar
spring-web-4.1.8.RELEASE.jar
为什么你'PropertyPlaceholderConfigurer'和'PropertySourcesPlaceholderConfigurer'?你为什么在两者都有'application.properties'? – jny
拼命地试图让这个工作和重叠的想法。我可能只需要一个,在清理过程中可能会删除一个。关于如何获得非Spring Boot程序,就像我的情况一样,要使用配置服务器,你有没有任何输入? – redboy
您是否仅使用PropertySourcesPlaceholderConfigurer进行了尝试?这是从外部属性文件中读取的文件 – jny