Spring boot Spring不识别要清理的自定义键,而是指默认键

Spring boot Spring不识别要清理的自定义键,而是指默认键,spring-boot,spring-boot-actuator,Spring Boot,Spring Boot Actuator,Spring似乎没有读取自定义键来清除值(它只是指默认值) 我在application.properties文件中添加了以下属性 endpoints.env.id=env endpoints.env.sensitive=true endpoints.env.enabled=true endpoints.env.keys-to-sanitize=port 启动应用程序并导航到/env端点后,我得到以下响应 "endpoints.env.keys-to-sanitize":{&

Spring似乎没有读取自定义键来清除值(它只是指默认值)

我在
application.properties
文件中添加了以下属性

endpoints.env.id=env
endpoints.env.sensitive=true
endpoints.env.enabled=true
endpoints.env.keys-to-sanitize=port
启动应用程序并导航到/env端点后,我得到以下响应

"endpoints.env.keys-to-sanitize":{"value":"port","origin":"URL 
[file:./application.properties]:40:32"},"endpoints.env.sensitive":{"value":"true","origin":"URL 
[file:./application.properties]:41:25"},"endpoints.env.enabled":{"value":"true","origin":"URL 
[file:./application.properties]:42:23"},"password":{"value":"******","origin":"URL 
[file:./application.properties]:43:10"} ,
"management.port":{"value":"8081","origin":"URL [file:./application.properties]:36:17"}
请注意,端口仍然可见,密码用****屏蔽


我错过了什么吗。我的要求是再添加几个键来隐藏它们的值。

如果您使用的是Spring Boot版本2及更高版本,则属性已更改。 有关更多详细信息,请按照


什么是spring boot版本?如果您使用的是版本2或更高版本,那么您使用的属性已经被弃用了一段时间。我正在使用SpringBootVersion-2.1.18将尝试使用新属性(它已工作:)。但是spring文档网站上没有提到它@马科斯,请你把它作为一个答案贴出来好吗。我会接受的。它可以帮助其他面临类似问题的人。