मैं Spring Integration
के मौजूदा xml को 4.0.0.
एनोटेशन में रीफैक्टर करने का प्रयास कर रहा हूं।स्प्रिंग इंटीग्रेशन एक्सएमएल को एनोटेशन सपोर्ट में रीफैक्टर कैसे करें?
<!-- 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" />
लेकिन मैं त्रुटि चैनल को सेवा सक्रियक को कैसे जोड़ सकता हूं क्योंकि यह 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
}
}
धन्यवाद जिसने बहुत मदद की। बेशक मेरे पास मेरे कोड में '@ ComponentScan' है। गायब टुकड़ा यह था कि मैं बस अन्य सभी बीन्स के रूप में डिफ़ॉल्ट त्रुटि चैनल इंजेक्ट कर सकता हूं, जैसे: '@Qualifier ("errorChannel") MessageChannel errorChannel'। यह अब एक्सएमएल कॉन्फ़िगरेशन के बिना ठीक चलाता है। – membersound