Spring EL 变量列表? [英] List of Spring EL Variables?

查看:23
本文介绍了Spring EL 变量列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Spring EL 支持一些预定义的变量

Spring EL supports a some predefined variables

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

前两个曾经记录在 Spring 参考:第 6 章 Spring 表达式语言 (SpEL).Spring Reference 中没有提到另外两个(或者我没有找到它们.)(我在这个 slides,以及它在 spring social 和这个问题).

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).

所以我的问题是:是否有或多或少完整的预定义 spring-el 变量列表?

我猜这些预定义变量中的一些不是由 spring 核心本身定义的,而是通过激活"某些模块(如 spring-mvc)来定义的.所以我对在或多或少常见的 spring + jpa + mvc + 安全应用程序中可用的变量很感兴趣.

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.

推荐答案

我无法回答你的根本问题,但我可以给你一个提示.

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

在您的应用程序上下文启动时注册了一些预定义的 bean,但这取决于您使用的上下文类型.

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

通常存在 systemPropertiessystemEnvironment.在 Web 应用程序中加载 Spring,您还将获得 servletContextcontextParameterscontextAttributes.我假设 requestsession 也与 Web 应用程序上下文相关.

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.

我在调试使用 Spring 3.0.6RELEASE 的应用程序时发现了这一点.一个好的起点是 SpringBeanELResolver.getValue() 方法.

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

这篇关于Spring EL 变量列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆