Skip to content

Properties Migrator does not detect properties of Map type that are marked as deprecated #27854

Closed
@jvillarb

Description

@jvillarb

If we set a Map property as deprecated, because it is replaced or removed, the Spring Boot Properties Migrator module, when scanning the application environment and printing diagnostics, does not detect these types of properties.

For example, if we have the custom.logging.log-level property of type java.util.Map defined in the the metadata file as follows:

{
  "name": "custom.logging.log-level",
  "type": "java.util.Map<java.lang.String,java.lang.String>",
  "description": "",
  "deprecation": {
	"level": "error",
	"replacement": "logging.level"
  }
}

and set in the application.yml:

custom:
  logging:
      log-level:
          xx.xxxx.xxxx: INFO

When the spring-boot-properties-migrator module is included and the application is run, the generated report does not show that this property has been replaced by "logging.level".

The same problem can also be encountered with the management.health.status.http-mapping property of the spring-boot-actuator-autoconfigure library:

{
  "name": "management.health.status.http-mapping",
  "type": "java.util.Map<java.lang.String,java.lang.Integer>",
  "sourceType": "org.springframework.boot.actuate.autoconfigure.health.HealthIndicatorProperties",
  "deprecated": true,
  "deprecation": {
	"replacement": "management.endpoint.health.status.http-mapping"
  }
}
spring:
  http:
    encoding:
      charset: UTF-8

management:
  health:
    status:
      http-mapping:
        down: 500
        out_of_service: 503
        warning: 500

The displayed result does not show the deprecated property management.health.status.http-mapping.

[WARN ] 2021-09-02 16:35:49.601 [main]     PropertiesMigrationListener - 
The use of configuration keys that have been renamed was found in the environment:

Property source 'applicationConfig: [classpath:/config/application.yml]':
	Key: spring.http.encoding.charset
		Line: 9
		Replacement: server.servlet.encoding.charset


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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions