xml文件是否是activeProfile的设置
<?xml version="1.0" encoding="UTF-8"?>
<beans profile="dev"
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
">
</beans>
需要在在环境中添加变量spring.profiles.active=dev,源码部分见:
实例化bean的入口
采用构造器newInstance的方式创建实例(注意该操作并未初始化对象)
执行aware(BeanNameWare,BeanClassLoaderAware,BeanFactoryAware)的地方
初始化前,执行其他Aware的地方
spring对bean的三级缓存
执行BeanPostProcess的地方