Reputation: 5
I am trying to build a spring boot project with spring integration to handle incoming as2 messages using a custom inbound-channel-adapter. for some reason the ref argument of the adapter is not finding a bean definition for my class.
I have the followed spring reference files and online resources and have the following understanding:
@ImportResource("/integration/integration.xml")
annotation pointing to my spring integration xml file adds it to the application context
@SpringBootApplication
@ImportResource("/integration/integration.xml")
public class MyApplication implements ServletContextListener {
public static void main(String[] args) {
SpringApplication.run(MyApplication.class, args);
}
@Component
annotation above my class should make it autodetectable as a bean by my spring boot application@Component
public class MyHandlerModule extends AbstractProcessorModule implements IProcessorStorageModule {
private static final Logger LOGGER = LoggerFactory.getLogger(MyHandlerModule.class);
@Override
public boolean canHandle(@Nonnull String s, @Nonnull IMessage iMessage, @Nullable Map<String, Object> map) {
LOGGER.info(" Handle Info:" + s);
LOGGER.info(map.toString());
return s.equals(DO_STORE);
}
@SneakyThrows
@Override
public void handle(@Nonnull String s, @Nonnull IMessage iMessage, @Nullable Map<String, Object> map) {
LOGGER.info("----- AS2 MESSAGE RECEIVED !!! ------");
}
}
integration.xml
file with the following message:A component required a bean named 'com.example.MyHandlerModule' that could not be found.
For reference, here is my integration.xml
file:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration https://www.springframework.org/schema/integration/spring-integration.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">
<int:channel id="as2MessageChannel"/>
<int:inbound-channel-adapter id="as2" ref="com.example.MyHandlerModule" method="handle" channel="as2MessageChannel"/>
</beans>
Is there something I am missing?
Upvotes: 0
Views: 502
Reputation: 121292
The error is correct : without any custom name the framework makes it like myHandlerModule
- the camel case based on a simple class name . The package is not involved in bean naming . Not sure what made you to point fully qualified class name in that ref…
Upvotes: 0