Skip to content

Provide a flag to disable SpEL supportΒ #25153

Closed

Description

@sdeleuze

Along to #25151, this issue intend to provide a spring.spel.ignore flag to disable SpEL support in a way that prevent it to be compiled intro GraalVM native images.

For the record this allows to reduce native image size by 1.4M, RSS memory consumption by 2M and build time by 5.5s with Java 8.

Usage of SpEL support with the flag enabled should trigger a proper exception with a message explaining how to re-enable it.

The work done on spring-graalvm-native substitutions has allows to identify a first set of classes where SpEL support should be removed:

  • Remove EventExpressionEvaluator usage from org.springframework.context.event.EventListenerMethodProcessor and org.springframework.context.event.ApplicationListenerMethodAdapter
  • Remove beanFactory.setBeanExpressionResolver(new StandardBeanExpressionResolver(beanFactory.getBeanClassLoader()); from org.springframework.context.support.AbstractApplicationContext

Such flag could also be used on Spring Boot side as well if needed.

Activity

  1. added this to the 5.3 M1 milestone on May 28, 2020
  2. self-assigned this
    on May 28, 2020
  3. added 3 commits that reference this issue on Jun 18, 2020
    d30a5eb
  4. added a commit that references this issue on Jun 21, 2020
    6e2a514
  5. matthenry87 commented on Jan 6, 2021

    @matthenry87

    If we want to use things like Spring Security's @PreAuth annotation, is it still possible to omit this flag and use SpEL in an application compiled into a native image?

  6. added a commit that references this issue on Sep 17, 2026
    1c75f95
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions