Search code examples
spring-bootspring-integration

Spring Integration XML Configuration and Spring Boot Java Annotation Configuration


Is it possible to have spring integration xml configuration and spring boot java annotation configuration at the same time? Can you please refer with an example on this? What is the best practice for this?

Thanks


Solution

  • As Marten pointed out it is fully fine to combine Spring Boot with an XML configuration. See Spring Boot docs: https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#using.configuration-classes.importing-xml-configuration

    If you absolutely must use XML based configuration, we recommend that you still start with a @Configuration class. You can then use an @ImportResource annotation to load XML configuration files.

    And here is the sample: https://github.com/spring-projects/spring-boot/blob/main/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-xml/src/test/java/smoketest/xml/SampleSpringXmlPlaceholderBeanDefinitionTests.java