org.zodiac.actuate.env.ApplicationWritableEnvironmentEndpointWebExtension Maven / Gradle / Ivy
package org.zodiac.actuate.env;
import java.util.Collections;
import java.util.Map;
import org.springframework.boot.actuate.endpoint.annotation.DeleteOperation;
import org.springframework.boot.actuate.endpoint.annotation.WriteOperation;
import org.springframework.boot.actuate.endpoint.web.annotation.EndpointWebExtension;
import org.springframework.boot.actuate.env.EnvironmentEndpointWebExtension;
import org.zodiac.core.context.environment.AppEnvironmentManager;
@EndpointWebExtension(endpoint = ApplicationWritableEnvironmentEndpoint.class)
public class ApplicationWritableEnvironmentEndpointWebExtension extends EnvironmentEndpointWebExtension {
private AppEnvironmentManager environment;
public ApplicationWritableEnvironmentEndpointWebExtension(ApplicationWritableEnvironmentEndpoint endpoint,
AppEnvironmentManager environment) {
super(endpoint);
this.environment = environment;
}
@WriteOperation
public Object write(String name, String value) {
this.environment.setProperty(name, value);
return Collections.singletonMap(name, value);
}
@DeleteOperation
public Map reset() {
return this.environment.reset();
}
public void setEnvironmentManager(AppEnvironmentManager environment) {
this.environment = environment;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy