-
Notifications
You must be signed in to change notification settings - Fork 38.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explore how to pre-compile SpEL expressions during AOT processing #29548
Comments
StandardBeanExpressionResolver
not reachable in AOT mode
I've put some thought into this, and I'll share my findings here. The first challenge is saving the compiled bytecode to Luckily, we already have a prototype for that. At the end of the A simple implementation of that exists in Using that and running a SpEL compilation test currently generates files such as So, compiling the expressions and saving the generated byte code to disk should be achievable tasks. The main challenges that I foresee are:
The latter is necessary to successfully compile a SpEL expression. For example, a simple ternary expression such as |
The purpose of this issue is to explore if it is possible to remove SpEL implementation from the reachable code path by performing an AOT processing of SpEL expressions to generate related bytecode at build-time, and introduce a dedicated
BeanExpressionResolver
used in AOT mode without a dependency onStandardBeanExpressionResolver
with 3 goals:Pre-processing of SpEL expressions in annotations like Spring Framework
@Value
or Spring Security@PreAuthorize
/@PostAuthorize
/@PreFilter
/@PostFilter
(cc @rwinch) would be the main use cases, but other potential use cases ofBeanExpressionResolver
should be explored to ensure the feasibility of this optimization.Usage of SpEL in Thymeleaf would be probably out of the scope, or would require build-time compilation of Thymeleaf templates which is out of the scope of this issue, even if that's an interesting idea.
The text was updated successfully, but these errors were encountered: