您的位置: 首页 > 文章 > spring [email protected]和bean执行顺序问题 spring [email protected]和bean执行顺序问题 分类: 文章 • 2024-10-14 18:46:10 很多时候我们需要在某个bean初始化时,读取一个类的属性如: 从配置文件中获取配置使用@value,当你在bean加载时调用@value时会出现空指针异常。因为bean加载完成后才会执行@value。 方法一:写多一个配置类 方法二:定义为static类型