0

考虑以下代码:

    <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}"

我在这里做错什么了吗?

4

1 回答 1

0

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

我的方法是这样做:

<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

希望能帮助到你,

祝你好运!

于 2014-11-09T06:51:09.900 回答