How to get to endpoints using @Bean configuration

when I use the configuration as described in spring docs:

@Configuration
@EnableIntegration
public class MyFlowConfiguration {

    @Bean
    @InboundChannelAdapter(value = "inputChannel", poller = @Poller(fixedDelay = "1000"))
    public MessageSource<String> consoleSource() {
        return CharacterStreamReadingMessageSource.stdin();
    }

    @Bean
    @Transformer(inputChannel = "inputChannel", outputChannel = "httpChannel")
    public ObjectToMapTransformer toMapTransformer() {
        return new ObjectToMapTransformer();
    }

    @Bean
    @ServiceActivator(inputChannel = "httpChannel")
    public MessageHandler httpHandler() {
        HttpRequestExecutingMessageHandler handler = new HttpRequestExecutingMessageHandler("http://foo/service");
        handler.setExpectedResponseType(String.class);
        handler.setOutputChannelName("outputChannel");
        return handler;
    }

    @Bean
    @ServiceActivator(inputChannel = "outputChannel")
    public LoggingHandler loggingHandler() {
        return new LoggingHandler("info");
    }

}

What bean definition name can I use to reach the endpoints? When using the configuration through the components, information is provided in the documents:

beans (AbstractEndpoints MessageHandlers ( MessageSources - . ), xml. bean : [_] [methodName]. [decapitalizedAnnotationClassShortName] AbstractEndpoint .handler(.source) MessageHandler (MessageSource) bean. MessageHandlers (MessageSources) 8.2, " ".

?

+4
1

, . "?", (, httpHandler):

@Autowire
@Qualifier("myFlowConfiguration.httpHandler.serviceActivator")
private AbstractEndpoint httpEndpoint;

, :

  • myFlowConfiguration - bean , @ServiceActivator. @Configuration

  • httpHandler @ServiceActivator

  • serviceActivator - @ServiceActivator.

?

UPDATE

xml, java, @Import

, . . @Import @Configuration bean , ( ConfigurationClassPostProcessor):

/* using fully qualified class names as default bean names */
 private BeanNameGenerator importBeanNameGenerator = new   AnnotationBeanNameGenerator() {
    @Override
    protected String buildDefaultBeanName(BeanDefinition definition) {
        return definition.getBeanClassName();
    }
};

, , unnamed.

, name myFlowConfiguration:

@Configuration("myFlowConfiguration")
@EnableIntegration
public class MyFlowConfiguration {
+4

All Articles