activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruce Snyder <>
Subject Re: bean.jar in /lib folder without SpringXML config also called at startup?
Date Wed, 18 Aug 2010 07:37:19 GMT
On Wed, Aug 18, 2010 at 1:20 AM, BenXS <> 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" />

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.

perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"

ActiveMQ in Action:

View raw message