java - Spring Boot load beans from context xml in library -


i have 2 applications:

  • application child: it's spring app xml schema-based configuration. have applicationcontext.xml.

  • application parent: spring boot app. uses application child library.

is possible load beans defined in child xml, , put them parent context?

yes possible.

from javadoc:

as mentioned above, @configuration classes may declared regular spring definitions within spring xml files. it possible import spring xml configuration files @configuration classes using @importresource annotation. bean definitions imported xml can injected using @autowired or @import.

here example same javadoc mix beans loaded xml in beans defined in configuration class:

 @configuration  @importresource("classpath:/com/acme/database-config.xml")  public class appconfig {      @inject datasource datasource; // xml       @bean      public mybean mybean() {          // inject xml-defined datasource bean          return new mybean(this.datasource);      }  } 

Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -