On Wed, Aug 18, 2010 at 1:20 AM, BenXS <bxsto...@yahoo.co.uk> wrote: > > Assume I develop a Java Bean, compile it into a *.jar and copy it to the /lib > folder of ActiveMQ. > The configuration of this bean is NOT done by SpringXML but the > Broker+Connection setup is done only inside the java code. > > So Spring in ActiveMQ does not know anything about the Bean. > Does ActiveMQ in this case call and load this pure java bean AUTOMATICALLY > at startup as well? > > Or do I have to declare this bean in activemq.xml anyway? > > If yes: How?
By dropping the jar file into the lib directory, the jar file will be placed on the classpath, but no beans from it will be loaded automagically. You need to tell ActiveMQ to load it via Spring config. Below is an example Spring XML config to place in the activemq.xml file to create an instance of the MyBean class: <bean id="foo" class="com.mycompany.MyBean"> <property name="hello" value="world" /> </bean> The XML above will create an instance of the com.mycompany.MyBean class from the jar on the classpath and execute its setHello method with an argument of 'world'. Hope that helps. Bruce -- perl -e 'print unpack("u30","D0G)u8...@4vyy9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*" );' ActiveMQ in Action: http://bit.ly/2je6cQ Blog: http://bruceblog.org/ Twitter: http://twitter.com/brucesnyder