Using spring3 @Value to access PropertyPlaceholderConfigurer values?

后端 未结 3 1329
猫巷女王i
猫巷女王i 2021-01-17 13:37

I\'m trying to set the value of a string in a spring bean using @Value, when my property source is a subclass of PropertyPlaceholderConfigurer. Any

3条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-17 14:12

    I don't think it is possible to access properties loaded by PropertyPlaceHolderConfigurer using SPEL in a @Value annotation. It would be great, but as far as I know, the next best thing is to declare:

    
    

    It can point to the same properties file as your PropertyPlaceHolderConfigurer.

提交回复
热议问题