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
DestinationResolverimplementation based on a SpringBeanFactory.Will lookup Spring managed beans identified by bean name, expecting them to be of type
javax.jms.Destination.- Since:
- 2.5
- Author:
- Juergen Hoeller
- See Also:
BeanFactory
Constructor Summary
Constructors Constructor Description BeanFactoryDestinationResolver()Create a new instance of theBeanFactoryDestinationResolverclass.BeanFactoryDestinationResolver(BeanFactory beanFactory)Create a new instance of theBeanFactoryDestinationResolverclass.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DestinationresolveDestinationName(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 Detail
BeanFactoryDestinationResolver
public BeanFactoryDestinationResolver()
Create a new instance of theBeanFactoryDestinationResolverclass.The BeanFactory to access must be set via
setBeanFactory.
BeanFactoryDestinationResolver
public BeanFactoryDestinationResolver(BeanFactory beanFactory)
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 lookupDestinatiosn
Method Detail
setBeanFactory
public void setBeanFactory(BeanFactory beanFactory)
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:
BeanInitializationException
resolveDestinationName
public Destination resolveDestinationName(Session session, String destinationName, boolean pubSubDomain) throws 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:
JMSException- if the JMS Session failed to resolve the destination