spring_boot @ImportResource 注解

@ImportResource

加载指定位置的的spring配置文件

使用方式:将这个注解写到一个配置类,或者主配置类上如下

bean.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="hellowService" class="com.springboot.springboot_demo.service.HellowService"></bean>
</beans>

猜你喜欢

转载自blog.csdn.net/adminBfl/article/details/100601742