Class BeanfactoryDestinationResolver
java.lang.Object
org.springframework.jms.support.destination.BeanfactoryDestinationResolver
- All Implemented Interfaces:
Aware, BeanfactoryAware, DestinationResolver
public class BeanfactoryDestinationResolver
extends Object
implements DestinationResolver, 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:
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new instance of theBeanfactoryDestinationResolverclass.BeanfactoryDestinationResolver(Beanfactory beanfactory) Create a new instance of theBeanfactoryDestinationResolverclass. -
Method Summary
Modifier and TypeMethodDescriptionjakarta.jms.DestinationresolveDestinationName(@Nullable jakarta.jms.Session session, String destinationName, boolean pubSubDomain) Resolve the given destination name, either as located resource or as dynamic destination.voidsetBeanfactory(Beanfactory beanfactory) Callback that supplies the owning factory to a bean instance.
-
Constructor Details
-
BeanfactoryDestinationResolver
public BeanfactoryDestinationResolver()Create a new instance of theBeanfactoryDestinationResolverclass.The Beanfactory to access must be set via
setBeanfactory.- See Also:
-
BeanfactoryDestinationResolver
Create a new instance of theBeanfactoryDestinationResolverclass.Use of this constructor is redundant if this object is being created by a Spring IoC container, as the supplied
Beanfactorywill be replaced by theBeanfactorythat creates it (c.f. theBeanfactoryAwarecontract). 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
Description copied from interface:BeanfactoryAwareCallback that supplies the owning factory to a bean instance.Invoked after the population of normal bean properties but before an initialization callback such as
InitializingBean.afterPropertiesSet()or a custom init-method.- Specified by:
setBeanfactoryin interfaceBeanfactoryAware- Parameters:
beanfactory- owning Beanfactory (nevernull). The bean can immediately call methods on the factory.- See Also:
-
resolveDestinationName
public jakarta.jms.Destination resolveDestinationName(@Nullable jakarta.jms.Session session, String destinationName, boolean pubSubDomain) throws jakarta.jms.JMSException Description copied from interface:DestinationResolverResolve the given destination name, either as located resource or as dynamic destination.- Specified by:
resolveDestinationNamein interfaceDestinationResolver- Parameters:
session- the current JMS Session (may benullif the resolver implementation is able to work without it)destinationName- the name of the destinationpubSubDomain-trueif the domain is pub-sub,falseif P2P- Returns:
- the JMS destination (either a topic or a queue)
- Throws:
jakarta.jms.JMSException- if the JMS Session failed to resolve the destination
-