Skip to content
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

Deprecate Constants utility and stop using it internally #30851

Closed
16 tasks done
sbrannen opened this issue Jul 10, 2023 · 2 comments
Closed
16 tasks done

Deprecate Constants utility and stop using it internally #30851

sbrannen opened this issue Jul 10, 2023 · 2 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing type: enhancement A general enhancement
Milestone

Comments

@sbrannen
Copy link
Member

sbrannen commented Jul 10, 2023

Overview

As discussed in #30846 (comment), since Constants is an outdated utility that uses reflection (which is not native-friendly), we should deprecate Constants and stop using it internally.

Related Issues

Deliverables

  • Deprecate Constants.
  • Stop using Constants in the code base.
    • spring-context
      • MBeanExporter
    • spring-aop
      • CustomizableTraceInterceptor
    • spring-beans
      • PropertyPlaceholderConfigurer
      • XmlBeanDefinitionReader
    • spring-context-support
      • CronTriggerFactoryBean
      • SimpleTriggerFactoryBean
    • spring-jdbc
      • IsolationLevelDataSourceAdapter
      • LazyConnectionDataSourceProxy
      • IsolationLevelDataSourceRouter
    • spring-jms
      • DefaultMessageListenerContainer
      • JmsActivationSpecConfig
      • JmsAccessor
    • spring-tx
      • AbstractPlatformTransactionManager
      • DefaultTransactionDefinition
@sbrannen sbrannen added in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement theme: aot An issue related to Ahead-of-time processing labels Jul 10, 2023
@sbrannen sbrannen added this to the 6.1.0-M3 milestone Jul 10, 2023
@sbrannen sbrannen self-assigned this Jul 10, 2023
@sbrannen sbrannen changed the title Avoid use of reflection via Constants in MBeanExporter Deprecate Constants and stop using it internally Jul 10, 2023
sbrannen added a commit that referenced this issue Jul 10, 2023
Prior to this commit, MBeanExporter used
org.springframework.core.Constants which used reflection to find
constant fields in the MBeanExporter class. Consequently, one had to
register reflection hints in order to use MBeanExporter in a GraalVM
native image.

This commit addresses this by replacing the use of the `Constants`
class with a simple java.util.Map which maps constant names to constant
values for the autodetect constants defined in MBeanExporter.

See gh-30851
Closes gh-30846
@sbrannen
Copy link
Member Author

See commit 679b668 for an example of how Constants can be replaced by a simple Map in some use cases.

sbrannen added a commit to sbrannen/spring-framework that referenced this issue Jul 16, 2023
@sbrannen sbrannen changed the title Deprecate Constants and stop using it internally Deprecate Constants utility and stop using it internally Jul 16, 2023
sbrannen added a commit to sbrannen/spring-framework that referenced this issue Jul 16, 2023
@jhoeller jhoeller modified the milestones: 6.1.0-M3, 6.1.0-M4 Jul 17, 2023
sbrannen added a commit that referenced this issue Jul 31, 2023
@snicoll
Copy link
Member

snicoll commented Sep 29, 2023

See #31328 - I wonder if a review of the changes above should be considered to see if a similar restriction was introduced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants