<?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="user02" class="com.koral.boot.bean.User">
<property name="name" value="zhangsan"/>
<property name="age" value="18"/>
</bean>
<bean id="pet02" class="com.koral.boot.bean.Pet">
<property name="name" value="jimmy"/>
</bean>
</beans>
@Configuration(proxyBeanMethods = true) //告诉SpringBoot这是一个配置类 == 配置文件
//@Import({DBHelper.class,User.class})
@ImportResource("classpath:beans.xml")
public class MyConfig {
boolean user02 = run.containsBean("user02");
System.out.println("user02组件:"+user02);
boolean pet02 = run.containsBean("pet02");
System.out.println("pet02组件:"+pet02);