import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.context.annotation.ImportResource; @Configuration @Import(CDPlayerConfig.class) //Unsupported before spring 4.2 @ImportResource("classpath:cons-injec.xml") //Import xml configuration items public class SoundSystemConfig { }
The @Configuration annotation means to define a configuration class.
Here, using the annotation @Bean is like the <bean> element in xml configuration, such as:
<bean id="cdPlayer" class="com.jiaobuchong.soundsystem.CDPlayer"> <property name="cd" ref="compactDisc" /> </bean>
@ImportResource is similar to when xml configuration:
<import resource="cons-injecxml" />
The @Import annotation is used to import other config beans, which is equivalent to the <import/> tag in the XML configuration
https://www.zhihu.com/question/47178104
@Import annotation
http://blog.csdn.net/heyutao007/ article/details/74994161 talks
about @import in spring boot
http://weiqingfei.iteye.com/blog/2361152