java - How does Spring start this app? -
i'm parsing through inherited code of java app deployed war file in jboss, , uses spring, jms, , hornetq. i'm trying figure out, lack of better phrase, makes app "go". of spring examples i've seen include application main() method, imperatively acts on beans provided spring context in way. application has no main(). far can tell, what's happening:
the war file's web.xml uses listener launch spring when application starts in jboss, , passes config file
<listener> <listener-class>org.springframework.web.context.contextloaderlistener</listener-class> </listener> <context-param> <param-name>contextconfiglocation</param-name> <param-value>classpath:application-context.xml</param-value> </context-param>
spring processes application-context.xml file, includes snippet:
<bean id="jmscontainer" class="org.springframework.jms.listener.defaultmessagelistenercontainer"> <property name="connectionfactory" ref="connectionfactory" /> <property name="destination" ref="destination" /> <property name="messagelistener" ref="applistenerproxy" />
through couple more references in application-context.xml, "applistenerproxy" refers class in application implements sessionawaremessagelistener, responds messages on queue.
the part that's tripping me don't see kind of code jmscontainer bean , it. well-defined id, such spring framework looking it? , if so, documented somewhere (along other ids framework might looking for)? http://docs.spring.io/spring/docs/current/spring-framework-reference/html/jms.html seemed closest found, doesn't specify whether id in examples convention, or if it's meaningful string.
thanks
containers in spring part of framework core. framework scan containers implement container interface, , initialize them.
this relies on inversion of control (ioc) principle.
for more information on ioc container, check page: ioc container
Comments
Post a Comment