Skip to content

Properties migrator does not migrate some additional properties renamed in 4.0 - #52810

Open
zhoubiao188 wants to merge 1 commit into
spring-projects:4.0.xfrom
zhoubiao188:fix-properties-migrator-missing-metadata-types
Open

zhoubiao188 wants to merge 1 commit into
spring-projects:4.0.xfrom
zhoubiao188:fix-properties-migrator-missing-metadata-types

Conversation

@zhoubiao188

Copy link
Copy Markdown
Contributor

gh-52801 made the properties migrator copy properties such as spring.data.mongodb.uri again by recording the replacement's type on the deprecated metadata entry. A number of entries that were missed still have no type, so the migrator still refuses to migrate them.

Impact

The migrator only copies a renamed property when the type of its metadata entry matches the type of the replacement. When the deprecated entry has no type, PropertyMigration#determineCompatibleType returns false and the value is discarded:

Key: spring.liquibase.labels
    Reason: Replacement key 'spring.liquibase.label-filter' uses an incompatible target type

Reproduced against the 4.0.9 artifacts, driving PropertiesMigrationReporter with the published metadata and a spring.liquibase.labels=a,b property source:

before after
spring.liquibase.label-filter null a,b
report error, incompatible target type warning, renamed key

The same happens for the other entries in this commit, all of which have level: error except the Groovy template ones (level: warning):

  • spring.data.cassandra.* (10) — contact-points, compression, the timeouts, request.page-size, request.throttler.type
  • spring.groovy.template.configuration.* (12)
  • management.trace.http.enabled, management.trace.http.include, management.trace.include
  • spring.liquibase.labels
  • spring.activemq.pool.maximum-active-session-per-connection, spring.artemis.pool.maximum-active-session-per-connection
  • server.max-http-header-size

Verification

The recorded type is in every case the type that the annotation processor generates for the replacement in the same branch:

$ ./gradlew :module:spring-boot-liquibase:compileJava
$ jshell ... # PropertiesMigrationReporter with spring.liquibase.labels=a,b
Key: spring.liquibase.labels
    Replacement: spring.liquibase.label-filter

Reverting only these metadata changes brings the "incompatible target type" error back for every property I checked (spring.groovy.template.configuration.auto-escape, spring.data.cassandra.contact-points, spring.activemq.pool.maximum-active-session-per-connection, server.max-http-header-size, management.trace.http.include, spring.liquibase.labels).

Deliberately not changed

  • Jetty's access log properties (server.jetty.accesslog.date-format, log-cookies, locale, ...) all point at server.jetty.accesslog.custom-format, whose value is a request log format. Copying a boolean or a date pattern into it would be wrong, so those entries stay without a type.
  • spring.reactor.stacktrace-mode.enabled — spring.reactor.debug-agent.enabled no longer exists in 4.0, so there is no type to record.

No test is added for the same reason as gh-52801: the entries are checked by reading META-INF/spring-configuration-metadata.json from the built module, which no unit test in those modules currently does.

The properties migrator only copies a deprecated property when the type of
its metadata entry matches the type of the replacement. Several entries for
properties that are no longer bound in 4.0 have no type, so the migrator
reported an incompatible target type and left the replacement unset. For
example, `spring.liquibase.labels=a,b` was reported as

    Key: spring.liquibase.labels
        Reason: Replacement key 'spring.liquibase.label-filter' uses an
        incompatible target type

and Liquibase then ran without the configured labels.

Record the replacement's type on the entries that are missing it. Entries
whose replacement is not a type compatible property, such as Jetty's access
log properties that are all replaced by `custom-format`, are left unchanged,
as are entries whose replacement no longer exists.

See spring-projectsgh-52801

Signed-off-by: zhoubiao188 <32508238+zhoubiao188@users.noreply.github.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue that has not yet been triaged. Contributions will not be accepted. label Nov 14, 2026
@philwebb philwebb removed the status: waiting-for-triage An issue that has not yet been triaged. Contributions will not be accepted. label Nov 14, 2026
@philwebb philwebb changed the title Migrate properties whose metadata has no type Properties migrator does not migrate some additional properties renamed in 4.0 Nov 14, 2026
@philwebb philwebb added the type: bug A general bug label Nov 14, 2026
@philwebb philwebb added this to the 4.0.x milestone Nov 14, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug A general bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants