Make use of new GetMapping and PostMapping annotations
Closes gh-5277
This commit is contained in:
@@ -18,8 +18,7 @@ package org.springframework.boot.actuate.endpoint.mvc;
|
||||
|
||||
import org.springframework.boot.actuate.endpoint.Endpoint;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
/**
|
||||
@@ -39,7 +38,7 @@ public class EndpointMvcAdapter extends AbstractEndpointMvcAdapter<Endpoint<?>>
|
||||
}
|
||||
|
||||
@Override
|
||||
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
public Object invoke() {
|
||||
return super.invoke();
|
||||
|
||||
@@ -26,9 +26,8 @@ import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.core.env.PropertySources;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
|
||||
@@ -49,7 +48,7 @@ public class EnvironmentMvcEndpoint extends EndpointMvcAdapter
|
||||
super(delegate);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{name:.*}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@GetMapping(value = "/{name:.*}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
@HypermediaDisabled
|
||||
public Object value(@PathVariable String name) {
|
||||
|
||||
@@ -22,9 +22,8 @@ import org.springframework.boot.actuate.endpoint.MetricsEndpoint;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
|
||||
@@ -45,7 +44,7 @@ public class MetricsMvcEndpoint extends EndpointMvcAdapter {
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{name:.*}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@GetMapping(value = "/{name:.*}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
@HypermediaDisabled
|
||||
public Object value(@PathVariable String name) {
|
||||
|
||||
@@ -23,8 +23,7 @@ import org.springframework.boot.actuate.endpoint.ShutdownEndpoint;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
/**
|
||||
@@ -39,7 +38,7 @@ public class ShutdownMvcEndpoint extends EndpointMvcAdapter {
|
||||
super(delegate);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST)
|
||||
@PostMapping
|
||||
@ResponseBody
|
||||
@Override
|
||||
public Object invoke() {
|
||||
|
||||
@@ -27,8 +27,7 @@ import org.springframework.context.support.StaticApplicationContext;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -168,7 +167,7 @@ public class EndpointHandlerMappingTests {
|
||||
}
|
||||
|
||||
@Override
|
||||
@RequestMapping(method = RequestMethod.POST)
|
||||
@PostMapping
|
||||
public Object invoke() {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user