How do I get a property value from an ApplicationContext object? (not using an annotation)

前端 未结 3 986
一生所求
一生所求 2020-12-14 14:18

If I have:

@Autowired private ApplicationContext ctx;

I can get beans and resources by using one of the the getBean methods. However, I can

3条回答
  •  生来不讨喜
    2020-12-14 14:45

    In the case where SPeL expression needs to be dynamic, get the property value manually:

    somePropValue = ctx.getEnvironment().getProperty("someProp");
    

提交回复
热议问题