将@value放在set方法上

@Value("#{settings.xxx}")
    public void setName(String name) {
        this.name = name;
    }

spring的配置文件中(applicationContext.xml)添加util:

<beans xmlns:util="http://www.springframework.org/schema/util" 
    xsi:schemaLocation="http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd"> 
</beans> 

<util:properties id="settings" location="classpath:yyy.properties"></util:properties>

在yyy.properties里写值:

xxx=varxxx

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-03
  • 2021-04-10
  • 2022-12-23
  • 2022-01-16
猜你喜欢
  • 2022-12-23
  • 2021-04-07
  • 2021-09-26
  • 2022-12-23
  • 2021-05-21
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案