List of Spring EL Variables?

后端 未结 2 864
感情败类
感情败类 2020-12-16 04:47

Spring EL supports a some predefined variables

  • {#systemProperties. ... }
  • {#systemEnvironment. ... }
  • {#request
相关标签:
2条回答
  • 2020-12-16 05:12

    I can not answer your root question but I may give you a hint.

    There are some predefined beans registered at start up of your application context but which depends on the context type you are using.

    Commonly, systemProperties and systemEnvironment are present. Loading Spring within a web application, you will also get servletContext, contextParameters and contextAttributes. I assume, request and session are related to a web application context as well.

    I discovered this during debugging of my application which uses Spring 3.0.6RELEASE. A good starting point is SpringBeanELResolver.getValue() method.

    0 讨论(0)
  • 2020-12-16 05:16

    I also notice that environment resolves to the current org.springframework.core.env.Environment instance. I am not sure this is a documented feature, but I was looking for a concise way to do the following in my @Configuration class:

    @Value("#{environment.acceptsProfiles('test')}")
    private boolean test;
    

    Which then allows me to switch off this value in further bean defintions.

    I have submitted the following JIRA to address this issue:

    https://jira.springsource.org/browse/SPR-9037

    0 讨论(0)
提交回复
热议问题