Skip navigation


Access Hermes Beans from Spring

If you want to use Hermes programmatically, you can load up and access a Hermes bean directly from a Spring context:

<beans>
	<jee:jndi-lookup id="hermes" jndi-name="EMS">
		<jee:environment>
  			java.naming.factory.initial=hermes.HermesInitialContextFactory
  			java.naming.provider.url=/.hermes/hermes-config.xml
  		</jee:environment>
	</jee:jndi-lookup>
</beans>

From your Java code you now have a Hermes bean to message with:

ClassPathXmlApplicationContext beans = new ClassPathXmlApplicationContext(new String[] { "spring-beans.xml" });

Hermes hermes = (Hermes ) beans.getBean("hermes");

Simple!

Adaptavist Theme Builder Powered by Atlassian Confluence