Ccodemod

codemod/spring-7-api-config-migration

Conservative Spring Framework 7 Java migration codemod that rewrites exact-safe API, annotation, configuration, and compatibility-branch patterns under main and test Java source sets.

upgradebreaking-changespringjavav7
Public
0 executions

Run locally

npx codemod @codemod/spring-7-api-config-migration

@codemod/spring-7-api-config-migration

Conservative Spring Framework 7 Java migration codemod for Java source under src/main/java/** and src/test/java/**. It applies deterministic AST-based rewrites for exact-safe Spring 7 baseline upgrades and avoids compatibility rewrites that require symbol resolution or project-specific policy.

What It Rewrites

  • WebMvcConfigurerAdapter, AsyncConfigurerSupport, SchedulingConfigurerSupport, and WebSocketMessageBrokerConfigurerAdapter superclass usage to direct interface implementation.
  • Redundant single-constructor @Autowired annotations.
  • Spring @Required annotations.
  • Obsolete @ConstructorBinding markers.
  • javax.validation.* imports to jakarta.validation.*.
  • LocalVariableTableParameterNameDiscoverer to StandardReflectionParameterNameDiscoverer for imported or fully-qualified type references.
  • Simple PropertySourcesPlaceholderConfigurer bean methods that only return a new default instance from an annotation-based @Configuration class.
  • Exact Spring-version compatibility branches using SpringVersion.getVersion() and allowlisted ClassUtils.isPresent(...) checks whose outcome is dead on a Spring 7 baseline.

Preserve Cases

  • User-defined types that only share a Spring adapter simple name.
  • Constructors where @Autowired is still required because multiple constructors exist.
  • PropertySourcesPlaceholderConfigurer beans with custom settings or initialization logic.
  • Optional-library probes unrelated to Spring baseline compatibility.
  • Production SocketUtils replacement, field-to-constructor injection, and other policy-sensitive rewrites from the broader spec.

Run

bash

Development

bash

License

MIT

Ready to contribute?

Build your own codemod and share it with the community.