我是JMS的新手,能够创建与服务器的连接并接收JMS消息。但是现在我希望为它添加SSL支持,我面临着一个问题。有人可以告诉我该怎么做,下面是常规非SSL连接的代码。我可以使用System.setProperty(javax.net.ssl.keyStore,javax.net.ssl.keyStorePassword,javax.net.ssl.trustStore,javax.net.ssl.trustStorePassword)单独设置密钥库和信任库。但是,此代码需要一些我缺少的SSL启用。
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:jndi.properties</value>
</list>
</property>
</bean>
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.provider.url">${java.naming.provider.url}</prop>
<prop key="java.naming.factory.initial">${java.naming.factory.initial}</prop>
<prop key="java.naming.factory.url.pkgs">${java.naming.factory.url.pkgs}</prop>
<prop key="java.naming.security.principal">$java.naming.security.principal}</prop>
<prop key="java.naming.security.credentials">${java.naming.security.credentials}</prop>
</props>
</property>
</bean>
<bean id="connectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate" ref ="jndiTemplate"/>
<property name="jndiName" value="ConnectionFactory"/>
</bean>
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="connectionFactory"/>
<property name="defaultDestination" ref="destination"/>
<property name="pubSubDomain" value="true"/>
<property name="deliveryPersistent" value="true"/>
<property name="deliveryMode" value="2"/>
</bean>
<bean id="destination" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate" ref="jndiTemplate"/>
<property name="jndiName" value="ACS_BOOT"/>
</bean>
<!-- Listener Asynchronous -->
<bean id="acsBootListener" class="com.viasat.nbn.nms.acsjmssubscriber.AcsBootListener"/>
<jms:listener-container concurrency="5-10">
<jms:listener destination="ACS_BOOT" ref="acsBootListener"/>
</jms:listener-container>