79551922

Date: 2025-04-03 03:18:30
Score: 1
Natty:
Report link

Based on @andrei-stefan answer, you can try also:

environment.getPropertySources()
    .stream()
    .filter(MapPropertySource.class::isInstance)
    .map(MapPropertySource.class::cast)
    .map(MapPropertySource::getPropertyNames)
    .flatMap(Arrays::stream)
    //.anyMatch(propertyName -> propertyName.startsWith(key));
    .anyMatch(propertyName -> propertyName.equal(key));
Reasons:
  • Has code block (-0.5):
  • User mentioned (1): @andrei-stefan
  • Low reputation (0.5):
Posted by: kinlhp