Spring properties (property-placeholder) autowiring

前端 未结 5 1583
天命终不由人
天命终不由人 2021-01-01 09:03

I have in my applicationContext.xml






        
5条回答
  •  庸人自扰
    2021-01-01 09:27

    For spring 3.0, the correct way is the one shown - using @Value("${expression}")

    For spring pre-3.0, you can try:

    @Autowired
    private StringValueResolver resolver;
    

    There were no context initialization problems here, but I'm not sure it will work. Using the resolver you can resolve properties.

提交回复
热议问题