How to programmatically resolve property placeholder in Spring

后端 未结 6 1481
借酒劲吻你
借酒劲吻你 2020-12-04 19:17

I currently work on a web application based on Spring 3.1.0.M1, annotations based, and I have a problem with resolving property placeholders in one specific place of my appl

6条回答
  •  生来不讨喜
    2020-12-04 19:59

    I think rather than focusing on inner working of context place holder, you can simply define a new util:properties like this:

    
    

    and in your code, use it like this:

    Properties props = appContext.getBean("appProperties", Properties.class);
    

    OR like this wherever you can do DI:

    @Value("#{appProperties['app.resources.path']}")
    

提交回复
热议问题