Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
获取非Spring启动程序(如ActiveMQ)以使用Spring云配置_Spring_Spring Boot_Activemq - Fatal编程技术网

获取非Spring启动程序(如ActiveMQ)以使用Spring云配置

获取非Spring启动程序(如ActiveMQ)以使用Spring云配置,spring,spring-boot,activemq,Spring,Spring Boot,Activemq,为了更好地反映我的问题,我稍微修改了我原来的问题。我有一个非Spring启动应用程序,我希望它能与SpringCloudConfig服务器一起使用。我在网上搜索过很多东西,尝试过很多东西,但我的问题的症结似乎是服务器只在Spring启动环境下工作。尽管ActiveMQ已经是一个Spring应用程序,但将其转换为Spring启动应用程序似乎并不简单 我想要一个ActiveMQ代理,它是从SpringCloud配置中配置的。application.properties中的本地设置应替换为服务器中的设

为了更好地反映我的问题,我稍微修改了我原来的问题。我有一个非Spring启动应用程序,我希望它能与SpringCloudConfig服务器一起使用。我在网上搜索过很多东西,尝试过很多东西,但我的问题的症结似乎是服务器只在Spring启动环境下工作。尽管ActiveMQ已经是一个Spring应用程序,但将其转换为Spring启动应用程序似乎并不简单

我想要一个
ActiveMQ代理
,它是从SpringCloud配置中配置的。application.properties中的本地设置应替换为服务器中的设置。这在我工作的其他服务器上也可以使用,现在我需要它来为我的代理过滤器插件工作

我向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 />

调用构造函数时,
refreshendpoint
不一定初始化。您需要使用
@PostConstruct
添加一个方法注释(或者实现
初始化bean
并实现
afterPropertiesSet
方法),在其中执行
refreshendpoint.refresh(),例如:

@PostConstruct
void init() {
    refreshendpoint.refresh();
} 

对的我现在意识到了那次测试的愚蠢,那次测试只是为了看看它是否被加载。我最关心的是application.properties的替换。我将编辑我的原始帖子,以省略问题的这一部分。我的主要问题仍然没有回答。为什么您有
PropertyPlaceholderConfigurer
propertysourcesplaceplaceplaceconfigurer
?为什么两者都有
application.properties
。我可能只需要一个,并且可能会在清理过程中移除一个。关于获取一个非Spring启动程序(如我的例子中的ActiveMQ)来使用配置服务器,您是否有任何输入?您是否仅尝试使用PropertySourcesPlaceholderConfigurer?这是一个从外部属性读取的属性file@jny-是的。我现在正在尝试org.springframework.beans.factory.config.propertyplaceholderconfigurer这个问题有什么更新吗?
@PostConstruct
void init() {
    refreshendpoint.refresh();
}