Sto cercando di refactoring xml esistente di Spring Integration
alle nuove annotazioni 4.0.0.
.Come refript Spring Integration XML al supporto delle annotazioni?
<!-- the service activator is bound to the tcp input gateways error channel -->
<ip:tcp-inbound-gateway error-channel="errorChannel" />
<int:service-activator input-channel="errorChannel" ref="myService" />
Ma come posso associare l'attivatore di servizio al canale di errore come era in xml?
@Configuration
@EnableIntegration
public class Config {
@Bean
public TcpInboundGateway gate() {
TcpInboundGateway gateway = new TcpInboundGateway();
//??? how can I bind the service activator class as it was in xml?
gateway.setErrorChannel(MessageChannel);
return gateway;
}
}
@Service
public class MyService {
@ServiceActivator(inputChannel = "errorChannel")
public String send(String data) {
//business logic
}
}
Grazie che ha aiutato molto. Certamente ho '@ ComponentScan' nel mio codice. Il pezzo mancante era che posso semplicemente iniettare il canale di errore predefinito come tutti gli altri bean, come: '@Qualifier (" errorChannel ") MessageChannel errorChannel'. Ora funziona di nuovo senza configurazione xml. – membersound