spring-projects / spring-projects/spring-framework
Explore how to pre-compile SpEL expressions during AOT processing
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 60.2k
- Forks
- 38.8k
- Avg merge
- 5d 2h
- Merged PRs (30d)
- 27
Description
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 on StandardBeanExpressionResolver with 3 goals:
- Reduce the number of hints required at runtime on native due to SpEL reflection usage
- Avoid loading most of the SpEL infrastructure by default for optimization purpose
- Perform SpEL to bytecode generation at build-time to skip that processing at runtime
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 of BeanExpressionResolver 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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by examining the AOT processing path and the BeanExpressionResolver use cases described in the issue, including @Value and Spring Security method annotations. Determine whether SpEL can be compiled at build time without StandardBeanExpressionResolver and identify the runtime hints and infrastructure that could be removed. Done means establishing feasibility, scope, and the required design for an AOT-mode resolver.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- backend, build-system
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100