Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
308 views
in Technique[技术] by (71.8m points)

java - List of Spring EL Variables?

Spring EL supports a some predefined variables

  • {#systemProperties. ... }
  • {#systemEnvironment. ... }
  • {#request. ...}
  • {#session. ...}

The first two once are documented in the Spring Reference: chapter 6. Spring Expression Language (SpEL). The two others are not mentioned in the Spring Reference (or I did not found them.) (I found them in this slides, as well as its usage in spring social and this question).

So my question is: is there a more or less complete list of predefined spring-el variables?

I guess that some of this predefined variables are not defined by spring core itself, but by "activating" of some modules like spring-mvc. So I am interested in the the variables that are available in a more or less common spring + jpa + mvc + security application.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.9k users

...