下面列出了怎么用org.springframework.boot.actuate.web.mappings.MappingsEndpoint的API类实例代码及写法,或者点击链接到github查看源代码。
public ActuatorCommand(ApplicationContext applicationContext, Environment environment,
SshShellProperties properties, SshShellHelper helper,
@Lazy AuditEventsEndpoint audit, @Lazy BeansEndpoint beans,
@Lazy ConditionsReportEndpoint conditions,
@Lazy ConfigurationPropertiesReportEndpoint configprops, @Lazy EnvironmentEndpoint env,
@Lazy HealthEndpoint health,
@Lazy HttpTraceEndpoint httptrace, @Lazy InfoEndpoint info, @Lazy LoggersEndpoint loggers,
@Lazy MetricsEndpoint metrics,
@Lazy MappingsEndpoint mappings, @Lazy ScheduledTasksEndpoint scheduledtasks,
@Lazy ShutdownEndpoint shutdown,
@Lazy ThreadDumpEndpoint threaddump) {
this.applicationContext = applicationContext;
this.environment = environment;
this.properties = properties;
this.helper = helper;
this.audit = audit;
this.beans = beans;
this.conditions = conditions;
this.configprops = configprops;
this.env = env;
this.health = health;
this.httptrace = httptrace;
this.info = info;
this.loggers = loggers;
this.metrics = metrics;
this.mappings = mappings;
this.scheduledtasks = scheduledtasks;
this.shutdown = shutdown;
this.threaddump = threaddump;
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable().authorizeRequests().requestMatchers(EndpointRequest.to("health", "info")).permitAll()
.requestMatchers(EndpointRequest.toAnyEndpoint().excluding(MappingsEndpoint.class)).hasRole("ACTUATOR")
.requestMatchers(PathRequest.toStaticResources().atCommonLocations()).permitAll()
.antMatchers(HttpMethod.OPTIONS, "/**").permitAll().antMatchers(HttpMethod.GET, "/ping").permitAll()
.antMatchers(HttpMethod.DELETE, "/**").hasRole("ADMIN").antMatchers("/**").hasRole("USER").and()
.httpBasic();
// H2 database console runs inside a frame, So we need to disable X-Frame-Options
// in Spring Security.
http.headers().frameOptions().disable();
}
@Bean
@ConditionalOnMissingBean
public ActuatorMappingsDimension createMappingsDimension(MappingsEndpoint endpoint) {
return new ActuatorMappingsDimension(endpoint);
}
public ActuatorMappingsDimension(MappingsEndpoint endpoint) {
this.endpoint = endpoint;
}
@Bean
public ActuatorMappingsDimension createMappingsDimension(MappingsEndpoint endpoint) {
return new ActuatorMappingsDimension(endpoint);
}
/**
* Mappings method
*
* @return mappings
*/
@ShellMethod(key = "mappings", value = "Display mappings endpoint.")
@ShellMethodAvailability("mappingsAvailability")
public MappingsEndpoint.ApplicationMappings mappings() {
return mappings.mappings();
}
/**
* @return whether `mappings` command is available
*/
public Availability mappingsAvailability() {
return availability("mappings", MappingsEndpoint.class);
}
MappingsCommand(@Value("${sshd.system.command.roles.mappings}") String[] systemRoles,
MappingsEndpoint mappingsEndpoint) {
super(systemRoles);
this.mappingsEndpoint = mappingsEndpoint;
}