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));