I have a java config class that imports xml files with the @ImportResources annotation. In the java config I'd like to reference to beans that are defined in the xml config, e.g. like:
@Configuration
@ImportResource({
"classpath:WEB-INF/somebeans.xml"
}
)
public class MyConfig {
@Bean
public Bar bar() {
Bar bar = new Bar();
bar.setFoo(foo); // foo is defined in somebeans.xml
return bar;
}
}
I'd like to set the bean foo that has been defined in somebeans.xml to the bar bean that will be created in the java config class. How do I get the foo bean?