Default JmsListenerContainerFactory lookup

Prior to this commit, the default JmsListenerContainerFactory to use
must be explicitly set. Since having a single container factory is a
fairly common use case, we look up the default one automatically
using the bean name "jmsListenerContainerFactory".

It is still possible to provide an explicit default but since it refers
more to "the" container factory to use, the parameter has been
renamed to "containerFactory" which is shorter and more explicit.

The lookup strategy is lazy: if all endpoints are providing an
explicit container factory and no container factory with the
"jmsListenerContainerFactory" bean name exists, no exception
will be thrown.

Issue : SPR-11706
This commit is contained in:
Stephane Nicoll
2014-04-24 10:31:44 +03:00
parent 08f0395033
commit 4b0aba63df
15 changed files with 195 additions and 81 deletions

View File

@@ -43,13 +43,15 @@
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="default-container-factory" type="xsd:string" use="optional">
<xsd:attribute name="container-factory" type="xsd:string" use="optional">
<xsd:annotation>
<xsd:documentation><![CDATA[
Specifies the default org.springframework.jms.config.JmsListenerContainerFactory instance to
Specifies the org.springframework.jms.config.JmsListenerContainerFactory instance to
use to create the container for a jms listener endpoint that does not define a specific
factory. This permits in practice to omit the "containerFactory" attribute of the JmsListener
annotation. If not provided, each endpoint must define the container factory to use.
annotation. This attribute is not required as each endpoint may define the factory to use and,
as a convenience, the JmsListenerContainerFactory with name 'jmsListenerContainerFactory' is
looked up by default.
]]></xsd:documentation>
<xsd:appinfo>
<tool:annotation kind="ref">