Apache MQ transportConnectors uri value issue



考虑以下代码:

    <amq:transportConnectors>
        <amq:transportConnector uri="${esb.endpoint}"/>
    </amq:transportConnectors>

它无法解析uri值。我得到的错误是:

STACKTRACE:
at com.mincom.util.gadget.Starter.run(Starter.java:40)
THROWABLE: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean
definition with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in class 
path resource [minestar/esbadapter/service/EsbEmbeddedApacheContext.xml]: Could not 
resolve placeholder 'esb.endpoint' in string value "${esb.endpoint}"; nested exception 
is java.lang.IllegalArgumentException: Could not resolve placeholder 'esb.endpoint' in 
string value "${esb.endpoint}"

我在这里做错什么了吗?

很明显,spring找不到属性文件最简单的方法是查看属性文件的配置

我的方法是这样做:

<context:property-placeholder location="required.properties" />

为此,您需要在spring命名空间中添加以下内容

xmlns:context="http://www.springframework.org/schema/context"
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd

希望能有所帮助,

祝你好运!

最新更新