Class BeanFactoryDestinationResolver
java.lang.Object
org.springframework.jms.support.destination.BeanFactoryDestinationResolver
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanFactoryAware
,DestinationResolver
public class BeanFactoryDestinationResolver
extends Object
implements DestinationResolver, org.springframework.beans.factory.BeanFactoryAware
DestinationResolver
implementation based on a Spring BeanFactory
.
Will lookup Spring managed beans identified by bean name,
expecting them to be of type jakarta.jms.Destination
.
- Since:
- 2.5
- Author:
- Juergen Hoeller
- See Also:
-
BeanFactory
-
Constructor Summary
ConstructorDescriptionCreate a new instance of theBeanFactoryDestinationResolver
class.BeanFactoryDestinationResolver
(org.springframework.beans.factory.BeanFactory beanFactory) Create a new instance of theBeanFactoryDestinationResolver
class. -
Method Summary
Modifier and TypeMethodDescriptionresolveDestinationName
(Session session, String destinationName, boolean pubSubDomain) Resolve the given destination name, either as located resource or as dynamic destination.void
setBeanFactory
(org.springframework.beans.factory.BeanFactory beanFactory)
-
Constructor Details
-
BeanFactoryDestinationResolver
public BeanFactoryDestinationResolver()Create a new instance of theBeanFactoryDestinationResolver
class.The BeanFactory to access must be set via
setBeanFactory
. -
BeanFactoryDestinationResolver
public BeanFactoryDestinationResolver(org.springframework.beans.factory.BeanFactory beanFactory) Create a new instance of theBeanFactoryDestinationResolver
class.Use of this constructor is redundant if this object is being created by a Spring IoC container, as the supplied
BeanFactory
will be replaced by theBeanFactory
that creates it (c.f. theBeanFactoryAware
contract). So only use this constructor if you are using this class outside the context of a Spring IoC container.- Parameters:
beanFactory
- the bean factory to be used to lookupDestination
-
-
Method Details
-
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) - Specified by:
setBeanFactory
in interfaceorg.springframework.beans.factory.BeanFactoryAware
-
resolveDestinationName
public Destination resolveDestinationName(@Nullable Session session, String destinationName, boolean pubSubDomain) throws JMSException Description copied from interface:DestinationResolver
Resolve the given destination name, either as located resource or as dynamic destination.- Specified by:
resolveDestinationName
in interfaceDestinationResolver
- Parameters:
session
- the current JMS Session (may benull
if the resolver implementation is able to work without it)destinationName
- the name of the destinationpubSubDomain
-true
if the domain is pub-sub,false
if P2P- Returns:
- the JMS destination (either a topic or a queue)
- Throws:
JMSException
- if the JMS Session failed to resolve the destination
-