Spring EL 变量列表?
Spring EL 支持一些预定义变量
{#systemProperties. ... }
{#systemEnvironment. ... }
{#request. ...}
{#session. ...}
前两个记录在 Spring 参考:第 6 章 Spring 表达式语言 (SpEL)。 Spring参考中没有提到另外两个(或者我没有找到它们。)(我在这个 幻灯片,以及它在 Spring Social 和这个 问题)。
所以我的问题是:是否有一个或多或少完整的预定义 spring-el 变量列表?
我猜想其中一些预定义变量不是由 spring core 本身定义的,而是通过“激活”某些变量来定义的像 spring-mvc 这样的模块。因此,我对或多或少常见的 spring + jpa + mvc + 安全应用程序中可用的变量感兴趣。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我还注意到
environment
解析为当前的org.springframework.core.env.Environment
实例。我不确定这是一个已记录的功能,但我一直在寻找一种简洁的方法来在我的 @Configuration 类中执行以下操作:然后允许我在进一步的 bean 定义中关闭此值。
我已提交以下 JIRA 来解决此问题:
https://jira.springsource.org/browse/ SPR-9037
I also notice that
environment
resolves to the currentorg.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: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
我无法回答你的根本问题,但我可以给你一个提示。
在应用程序上下文启动时注册了一些预定义的 bean,但这取决于您正在使用的上下文类型。
通常,存在
systemProperties
和systemEnvironment
。在 Web 应用程序中加载 Spring,您还将获得servletContext
、contextParameters
和contextAttributes
。我假设,request
和session
也与 Web 应用程序上下文相关。我在调试使用 Spring 3.0.6RELEASE 的应用程序时发现了这一点。 SpringBeanELResolver.getValue() 方法是一个很好的起点。
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
andsystemEnvironment
are present. Loading Spring within a web application, you will also getservletContext
,contextParameters
andcontextAttributes
. I assume,request
andsession
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.