question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Document all predefined variables from ApplicationContext available in SpEL expressions

See original GitHub issue

Currently the document only mentioned systemProperties as predefined variable, actually all builtin beans registered by AbstractApplicationContext are predefined variables, such as environment and systemEnvironment and messageSource and applicationEventMulticaster and lifecycleProcessor. It’s worthy to add a new section describe those predefined variables.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jhoellercommented, May 18, 2020

I’ve revised the entire section a bit, adding a note that generally all beans in the context are available as predefined variables in SpEL expressions, including standard context beans… singling out environment, systemProperties and systemEnvironment (including their exposed Java type). This should cover all common cases since SPI beans in the context are really not meant to be commonly accessed in SpEL expressions.

1reaction
quaffcommented, May 11, 2020

It throws exception instead of print Unknown because no variable name defined

Can you please open a separate issue for that?

@sbrannen I’ve created https://github.com/spring-projects/spring-framework/pull/25045

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring Expression Language (SpEL)
and #pathVariables (values from path placeholders in the URI). For all SpEL expressions, a BeanResolver is available to enable references to ...
Read more >
Introduction to the Spring Expression Language (SpEL)
An introduction to the Spring Expression Language (SpEL), an important core feature of the Spring Framework.
Read more >
Spring Expression Language Guide - Baeldung
The Spring Expression Language (SpEL) is a powerful expression language that supports querying and manipulating an object graph at runtime.
Read more >
how to read System environment variable in Spring ...
Yes, you can do <property name="defaultLocale" value="#{ systemProperties['user.region']}"/> for instance. The variable systemProperties is predefined, see 6.4.
Read more >
Spring - Expression Language(SpEL) - GeeksforGeeks
SpEL expressions may also be used to define beans using annotation-based configuration metadata. To define a default value, use the @Value ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found