@ImportResource 导入Spring 的xml配置文件

在配置类尚标注此注解,等同于spring配置文件中的

<import resource="beans.xml"/>

Spring Boot里面没有Spring的配置文件,我们自己编写的配置文件,也不能自动识别;

想让Spring的配置文件生效,加载进来;@ImportResource标注在一个配置类上

@ImportResource(locations = {"classpath:beans.xml"})

猜你喜欢

转载自www.cnblogs.com/guchunchao/p/9854478.html