使用org.springframework.jndi.JndiObjectFactoryBean作为连接工厂

时间:2018-11-11 04:15:10

标签: java spring

我看到了如下所示的bean定义

<bean id="connectionFactoryReceiver" class="com.myutils.messaging.TopicConnectionFactoryProxy">
    <property name="connectionFactory">
        <bean class="org.springframework.jndi.JndiObjectFactoryBean">
            <property name="jndiName" value="/us/UAT/eod:tcf"/>
            <property name="jndiTemplate">
                <ref local="jndiTemplate"/>
            </property>
        </bean>
    </property>
    <property name="login" value=""/>
    <property name="password" value=""/>
</bean>

此外,TopicConnectionFactoryProxy类的设置器为

  public void setConnectionFactory(final QueueConnectionFactory connectionFactory) {
     if (connectionFactory == null) {
        throw new NullPointerException("connection factory can't be null");
    }
    this.connectionFactory = connectionFactory;
   }

我知道org.springframework.jndi.JndiObjectFactoryBean可以getObject()返回连接工厂对象。但是,可以“直接”注入它作为连接工厂类型吗?

0 个答案:

没有答案