Sie können Ihre eigene Implementierung von StandardEnvironment
bieten, wenn Ihre Spring-Boot-Anwendung Instancing.
Zum Beispiel:
public static void main(String[] args) {
SpringApplicationBuilder applicationBuilder = new SpringApplicationBuilder(Application.class)
.environment(new StandardEnvironment(){
@Override
protected void customizePropertySources(MutablePropertySources propertySources) {
// do not add system or env properties to the set of property sources
}
});
applicationBuilder.run(args);
}
Oder alternativ:
public static void main(String[] args) {
SpringApplicationBuilder applicationBuilder = new SpringApplicationBuilder(Application.class)
.environment(new StandardEnvironment(){
@Override
public Map<String, Object> getSystemEnvironment() {
return new HashMap<>();
}
@Override
public Map<String, Object> getSystemProperties() {
return new HashMap<>();
}
});
applicationBuilder.run(args);
}
So oder so, stellen Sie sicher, dass die Eigenschaften Ihrer Anwendung keine System- oder Umgebungseigenschaften enthalten.
einen bestimmten Grund, warum Sie es tun möchten? nur um den Kontext zu verstehen – pvpkiran