Hi Jimmy,

If you would like to provide different destination resolvers for different
environments, use Spring Boot conditionals. For example:

@ConditionalOnProperty(name = "env", matchIfMissing = true)
@Bean(name="wmq")
DestinationResolver devdestinationResolver() {...}

@ConditionalOnProperty(name = "env", havingValue = "production")
@Bean(name="wmq")
DestinationResolver prodDestinationResolver() {...}

@ConditionalOnProperty(name = "env", havingValue = "staging")
@Bean(name="wmq")
DestinationResolver stagingDestinationResolver() {...}

Cheers!

pt., 25.09.2015 o 15:08 użytkownik Jimmy Selgen Nielsen <
jimmy.sel...@gmail.com> napisał:

>
> > On 25. sep. 2015, at 14.18, Henryk Konsek <hekon...@gmail.com> wrote:
> >
> > Hi Jimmy,
> >
> > If you would like to create a simple URI for the pre-configured
> component,
> > then Claus suggestion to create a Spring bean with name/alias matching
> your
> > target component, is a way to go. Register the pre-configured JMS
> component
> > via:
> >
> > @Bean(name = "wmq")
> > JmsComponent myWmqComponent() {
> >  JmsComponent  jmsComponent = new JmsComponent();
> >
> >  jmsComponent.setDestinationResolver(new MQDestinationResolver());
> >
> >  return jmsComponent;
> > }
> >
> >
> > Then use the "wmq" bean name in the endpoint URI:
> >
> >
> >  from("wmq:myQueue").to(…);
> >
>
> I was looking into this.
>
> I have multiple environments that i configure destination resolvers
> dynamically for, so it would have required manually registering them in the
> Spring context, which IIRC is a lot more work.
>
> I could use a BeanDefinitionRegistryPostProcessor, but since the
> destinationResolvers configuration is auto wired in, that wouldn’t work.
>
> I’ll keep looking at this when i have time, but for now the workaround
> actually works :)
>
> /J

-- 
Henryk Konsek
http://about.me/hekonsek

Reply via email to