Overview

As discussed in https://github.com/spring-projects/spring-framework/issues/30846#issuecomment-1628849776, 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

  • 30846

  • 30854

Deliverables

  • [x] Deprecate Constants.
  • [x] Stop using Constants in the code base.
  • spring-context
    • [x] MBeanExporter
  • spring-aop
    • [x] CustomizableTraceInterceptor
  • spring-beans
    • [x] PropertyPlaceholderConfigurer
    • [x] XmlBeanDefinitionReader
  • spring-context-support
    • [x] CronTriggerFactoryBean
    • [x] SimpleTriggerFactoryBean
  • spring-jdbc
    • [x] IsolationLevelDataSourceAdapter
    • [x] LazyConnectionDataSourceProxy
    • [x] IsolationLevelDataSourceRouter
  • spring-jms
    • [x] DefaultMessageListenerContainer
    • [x] JmsActivationSpecConfig
    • [x] JmsAccessor
  • spring-tx
    • [x] AbstractPlatformTransactionManager
    • [x] DefaultTransactionDefinition

Comment From: sbrannen

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

Comment From: snicoll

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