Spring IgnoreUnsolvablePlaceholder不工作

Spring IgnoreUnsolvablePlaceholder不工作,spring,property-placeholder,Spring,Property Placeholder,我正在spring上下文中使用IgnoreUnsolvablePlaceholder。 如下 <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>classpa

我正在spring上下文中使用IgnoreUnsolvablePlaceholder。 如下

<bean
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>classpath:messaging.properties</value>
            </list>
        </property>
        <property name="ignoreResourceNotFound" value="false" />
        <property name="ignoreUnresolvablePlaceholders" value="true" />
    </bean>
默认情况下,ApplicationContext实现急切地创建和 在初始化过程中配置所有单例bean。 通常,这种预实例化是可取的,因为 立即发现配置或周围环境, 而不是几个小时甚至几天后。当这种行为不存在时 您可以通过以下方法防止单例bean的预实例化: 将bean定义标记为已初始化。懒汉 bean告诉IoC容器在运行时创建一个bean实例 首先请求,而不是在启动时

您可以尝试使用下面的构造惰性地初始化您的bean吗

lazy init=“true”



你能解决这个问题吗?如果我注释掉Springbean,它就会起作用。但是我不想对引用bean id=“messageTopic1”的bean进行评论,所以如何阻止lazyinit=“true”Springbean被其他Springbean引用。
<bean id="messageTopic1" class="org.apache.activemq.command.ActiveMQTopic">
        <constructor-arg value="${amq.topic}" />
</bean>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans.xsd
            http://www.springframework.org/schema/context
            http://www.springframework.org/schema/context/spring-context-3.1.xsd">

    <bean
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>classpath:messaging.properties</value>
            </list>
        </property>
        <property name="ignoreResourceNotFound" value="false" />
        <property name="ignoreUnresolvablePlaceholders" value="true" />
    </bean>


    <!-- Active MQ Broker Configuration Details -->

    <bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL" value="${amq.url}" />
    </bean>

    <bean id="messageQueue1" class="org.apache.activemq.command.ActiveMQQueue">
        <constructor-arg value="${amq.queue}" />
    </bean>

    <bean id="messageTopic1" class="org.apache.activemq.command.ActiveMQTopic">
        <constructor-arg value="${amq.topic}" />
    </bean>

    <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
        <property name="connectionFactory" ref="connectionFactory" />
    </bean>

    <bean id="activeMQ" class="com.isc.common.messaging.AmqUtilityHelper">
        <property name="destination" ref="messageQueue1" />
        <property name="jmsTemplate" ref="jmsTemplate" />
    </bean>

    <!-- <bean id="activeMQ1" class="com.isc.common.messaging.AmqUtilityHelper">
        <property name="destination" ref="messageTopic1" />
        <property name="jmsTemplate" ref="jmsTemplate" />
    </bean> -->

    <bean id="messageBroker" class="com.isc.common.messaging.AmqUtilityHelper">
        <property name="activeBroker" value="${active.broker}" />
    </bean>

</beans>
#AMQ/Solace properties production:
# uncomment the borker to use
active.broker=activeMQ
#active.broker=solace
#active.broker=activeMQ



#AMQ Broker Properties
amq.url=failover:(tcp://localhost:61616)??initialReconnectDelay=2000&maxReconnectAttempts=5
amq.queue=messageQueue1
amq.topic=


#Solace Broker Properties
solace.url=smf://192.168.56.101:55555
solace.userName=spring_user@Solace_Spring_VPN
solace.passWord=spring_password
solace.jndiName=JNDI/CF/spring1
solace.queue=JNDI/Q/requests
#solace.topic=JNDI/topic1
   <bean id="messageTopic1" class="org.apache.activemq.command.ActiveMQTopic" 
  lazy-init="true">
            <constructor-arg value="${amq.topic}" />
    </bean>