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

PropertiesMigrationListener wrongly reports property as deprecated #35774

Closed
martinvisser opened this issue Jun 7, 2023 · 9 comments
Closed
Assignees
Labels
type: bug A general bug
Milestone

Comments

@martinvisser
Copy link

With the following configuration:

spring:
  kafka:
    producer:
      client-id: some-id
      ssl:
        key-password: secret
        key-store-location: classpath:keystore.jks # line 18
        key-store-password: secret
        trust-store-location: classpath:truststore.jks
        trust-store-password: secret

I get the following message:

[WARN] org.springframework.boot.context.properties.migrator.PropertiesMigrationListener - 
The use of configuration keys that have been renamed was found in the environment:

Property source 'migrate-Config resource 'class path resource [application-integration.yml]' via location 'optional:classpath:/'':
	Key: spring.kafka.producer.ssl.keystore-location
		Line: 18
		Replacement: spring.kafka.producer.ssl.key-store-location
	Key: spring.kafka.producer.ssl.keystore-password
		Line: 19
		Replacement: spring.kafka.producer.ssl.key-store-password
	Key: spring.kafka.producer.ssl.truststore-location
		Line: 20
		Replacement: spring.kafka.producer.ssl.trust-store-location
	Key: spring.kafka.producer.ssl.truststore-password
		Line: 21
		Replacement: spring.kafka.producer.ssl.trust-store-password

Property source 'Config resource 'class path resource [application-integration.yml]' via location 'optional:classpath:/'':
	Key: spring.kafka.producer.ssl.keystore-location
		Line: 18
		Replacement: spring.kafka.producer.ssl.key-store-location
	Key: spring.kafka.producer.ssl.keystore-password
		Line: 19
		Replacement: spring.kafka.producer.ssl.key-store-password
	Key: spring.kafka.producer.ssl.truststore-location
		Line: 20
		Replacement: spring.kafka.producer.ssl.trust-store-location
	Key: spring.kafka.producer.ssl.truststore-password
		Line: 21
		Replacement: spring.kafka.producer.ssl.trust-store-password


Each configuration key has been temporarily mapped to its replacement for your convenience. To silence this warning, please update your configuration to use the new keys.

But I already changed them to the new one. It's just a warning, but it seems to be incorrect. Also interesting it shows it twice with different property source names.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 7, 2023
@mhalbritter
Copy link
Contributor

mhalbritter commented Jun 7, 2023

This indeed looks like a bug. The org.springframework.boot.context.properties.migrator.PropertiesMigrationReporter#getMatchingProperties returns it as deprecated properties, because this line:

ConfigurationProperty match = propertySource.getConfigurationProperty(metadataName);

returns a non-null match when invoked with e.g. "spring.kafka.producer.ssl.keystore-location". I assume this is because of the relaxed mapping support in SpringIterableConfigurationPropertySource and "keystore" and "key-store" map to the same relaxed value.

However, I can't reproduce that you get those messages two times. Could you maybe provide a small sample which reproduces this double printing issue?

@mhalbritter mhalbritter added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 7, 2023
@mhalbritter mhalbritter added this to the 2.7.x milestone Jun 7, 2023
@mhalbritter mhalbritter changed the title Incorrect message in PropertiesMigrationListener? PropertiesMigrationListener wrongly reports property as deprecated Jun 7, 2023
@martinvisser
Copy link
Author

I see you added 2.7.x milestone, but forgot to mention this (also) happened using Spring Boot 3.1.0

@mhalbritter
Copy link
Contributor

I suspect the underlying cause is in Boot 2.7.x too. When we fix that bug there, we forward merge to 3.0.x and 3.1.x.

@p-palanisami

This comment was marked as outdated.

@mhalbritter

This comment was marked as outdated.

@philwebb philwebb modified the milestones: 2.7.x, 3.1.x Nov 8, 2023
@Wzy19930507

This comment was marked as outdated.

@philwebb

This comment was marked as outdated.

Wzy19930507 pushed a commit to Wzy19930507/spring-boot that referenced this issue Nov 16, 2023
because of the relaxed mapping support in SpringIterableConfigurationPropertySource, like "keystore" and "key-store" map to the same relaxed value.

valid metadata by `PropertyMapper`

Closes spring-projects#35774
@wilkinsona wilkinsona added the status: pending-design-work Needs design work before any code can be developed label Jan 17, 2024
@wilkinsona wilkinsona modified the milestones: 3.1.x, 3.2.x May 20, 2024
@philwebb philwebb self-assigned this Jun 26, 2024
@philwebb philwebb removed the status: pending-design-work Needs design work before any code can be developed label Jun 26, 2024
@philwebb philwebb modified the milestones: 3.2.x, 3.2.8 Jun 26, 2024
@arkinmodi

This comment was marked as outdated.

@philwebb

This comment was marked as outdated.

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 a pull request may close this issue.

8 participants