commit
752a42710c
|
|
@ -113,8 +113,8 @@ public class WebMvcMetricsFilter extends OncePerRequestFilter {
|
||||||
|
|
||||||
private void filterAndRecordMetrics(HttpServletRequest request,
|
private void filterAndRecordMetrics(HttpServletRequest request,
|
||||||
HttpServletResponse response, FilterChain filterChain)
|
HttpServletResponse response, FilterChain filterChain)
|
||||||
throws IOException, ServletException, NestedServletException {
|
throws IOException, ServletException {
|
||||||
Object handler = null;
|
Object handler;
|
||||||
try {
|
try {
|
||||||
handler = getHandler(request);
|
handler = getHandler(request);
|
||||||
}
|
}
|
||||||
|
|
@ -149,7 +149,7 @@ public class WebMvcMetricsFilter extends OncePerRequestFilter {
|
||||||
|
|
||||||
private void filterAndRecordMetrics(HttpServletRequest request,
|
private void filterAndRecordMetrics(HttpServletRequest request,
|
||||||
HttpServletResponse response, FilterChain filterChain, Object handler)
|
HttpServletResponse response, FilterChain filterChain, Object handler)
|
||||||
throws IOException, ServletException, NestedServletException {
|
throws IOException, ServletException {
|
||||||
TimingContext timingContext = TimingContext.get(request);
|
TimingContext timingContext = TimingContext.get(request);
|
||||||
if (timingContext == null) {
|
if (timingContext == null) {
|
||||||
timingContext = startAndAttachTimingContext(request, handler);
|
timingContext = startAndAttachTimingContext(request, handler);
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ public enum StaticResourceLocation {
|
||||||
*/
|
*/
|
||||||
FAVICON("/**/favicon.ico");
|
FAVICON("/**/favicon.ico");
|
||||||
|
|
||||||
private String[] patterns;
|
private final String[] patterns;
|
||||||
|
|
||||||
StaticResourceLocation(String... patterns) {
|
StaticResourceLocation(String... patterns) {
|
||||||
this.patterns = patterns;
|
this.patterns = patterns;
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ public final class PathRequest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a {@link StaticResourceRequest} that can be used to create a matcher for
|
* Returns a {@link StaticResourceRequest} that can be used to create a matcher for
|
||||||
* {@link StaticResourceLocation Locations}.
|
* {@link StaticResourceLocation locations}.
|
||||||
* @return a {@link StaticResourceRequest}
|
* @return a {@link StaticResourceRequest}
|
||||||
*/
|
*/
|
||||||
public static StaticResourceRequest toStaticResources() {
|
public static StaticResourceRequest toStaticResources() {
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ public final class StaticResourceRequest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The server web exchange matcher used to match against resource
|
* The server web exchange matcher used to match against resource
|
||||||
* {@link StaticResourceLocation Locations}.
|
* {@link StaticResourceLocation locations}.
|
||||||
*/
|
*/
|
||||||
public static final class StaticResourceServerWebExchange
|
public static final class StaticResourceServerWebExchange
|
||||||
implements ServerWebExchangeMatcher {
|
implements ServerWebExchangeMatcher {
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ public final class PathRequest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a {@link StaticResourceRequest} that can be used to create a matcher for
|
* Returns a {@link StaticResourceRequest} that can be used to create a matcher for
|
||||||
* {@link StaticResourceLocation Locations}.
|
* {@link StaticResourceLocation locations}.
|
||||||
* @return a {@link StaticResourceRequest}
|
* @return a {@link StaticResourceRequest}
|
||||||
*/
|
*/
|
||||||
public static StaticResourceRequest toStaticResources() {
|
public static StaticResourceRequest toStaticResources() {
|
||||||
|
|
|
||||||
|
|
@ -90,12 +90,10 @@ public class StaticResourceRequestTests {
|
||||||
this.resourceRequest.atCommonLocations().excluding(null);
|
this.resourceRequest.atCommonLocations().excluding(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private StaticResourceRequestTests.RequestMatcherAssert assertMatcher(
|
private RequestMatcherAssert assertMatcher(ServerWebExchangeMatcher matcher) {
|
||||||
ServerWebExchangeMatcher matcher) {
|
|
||||||
StaticWebApplicationContext context = new StaticWebApplicationContext();
|
StaticWebApplicationContext context = new StaticWebApplicationContext();
|
||||||
context.registerBean(ServerProperties.class);
|
context.registerBean(ServerProperties.class);
|
||||||
return assertThat(
|
return assertThat(new RequestMatcherAssert(context, matcher));
|
||||||
new StaticResourceRequestTests.RequestMatcherAssert(context, matcher));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class RequestMatcherAssert implements AssertDelegateTarget {
|
private static class RequestMatcherAssert implements AssertDelegateTarget {
|
||||||
|
|
|
||||||
|
|
@ -1339,7 +1339,7 @@ provided:
|
||||||
|
|
||||||
[source,properties,indent=0]
|
[source,properties,indent=0]
|
||||||
----
|
----
|
||||||
management.metrics.export.signalfx.acesss-token=YOUR_ACCESS_TOKEN
|
management.metrics.export.signalfx.access-token=YOUR_ACCESS_TOKEN
|
||||||
----
|
----
|
||||||
|
|
||||||
You can also change the interval at which metrics are sent to SignalFx:
|
You can also change the interval at which metrics are sent to SignalFx:
|
||||||
|
|
|
||||||
|
|
@ -260,7 +260,7 @@ public class ApplicationContextAssertTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getBeanOfTypeWhenInParentWithLimtedScopeShouldReturnNullAssert() {
|
public void getBeanOfTypeWhenInParentWithLimitedScopeShouldReturnNullAssert() {
|
||||||
this.parent.registerSingleton("foo", Foo.class);
|
this.parent.registerSingleton("foo", Foo.class);
|
||||||
assertThat(getAssert(this.context)).getBean(Foo.class, Scope.NO_ANCESTORS)
|
assertThat(getAssert(this.context)).getBean(Foo.class, Scope.NO_ANCESTORS)
|
||||||
.isNull();
|
.isNull();
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ import org.springframework.boot.configurationsample.ReadOperation;
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An meta-annotated endpoint similar to {@code @WebEndpoint} or {@code @JmxEndpoint} in
|
* A meta-annotated endpoint similar to {@code @WebEndpoint} or {@code @JmxEndpoint} in
|
||||||
* Spring Boot. Also with a package private read operation that has an optional argument.
|
* Spring Boot. Also with a package private read operation that has an optional argument.
|
||||||
*
|
*
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ package org.springframework.boot.configurationsample.endpoint.incremental;
|
||||||
import org.springframework.boot.configurationsample.MetaEndpoint;
|
import org.springframework.boot.configurationsample.MetaEndpoint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An meta-annotated endpoint similar to {@code @WebEndpoint} or {@code @JmxEndpoint} in
|
* A meta-annotated endpoint similar to {@code @WebEndpoint} or {@code @JmxEndpoint} in
|
||||||
* Spring Boot.
|
* Spring Boot.
|
||||||
*
|
*
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ import org.apache.commons.compress.archivers.jar.JarArchiveOutputStream;
|
||||||
import org.apache.commons.compress.archivers.zip.UnixStat;
|
import org.apache.commons.compress.archivers.zip.UnixStat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes JAR content, ensuring valid directory entries are always create and duplicate
|
* Writes JAR content, ensuring valid directory entries are always created and duplicate
|
||||||
* items are ignored.
|
* items are ignored.
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
|
|
@ -247,7 +247,7 @@ public class JarWriter implements LoaderClassesWriter, AutoCloseable {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform the actual write of a {@link JarEntry}. All other {@code write} methods
|
* Perform the actual write of a {@link JarEntry}. All other write methods
|
||||||
* delegate to this one.
|
* delegate to this one.
|
||||||
* @param entry the entry to write
|
* @param entry the entry to write
|
||||||
* @param entryWriter the entry writer or {@code null} if there is no content
|
* @param entryWriter the entry writer or {@code null} if there is no content
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ public class NettyReactiveWebServerFactory extends AbstractReactiveWebServerFact
|
||||||
/**
|
/**
|
||||||
* Set the maximum amount of time that should be waited when starting or stopping the
|
* Set the maximum amount of time that should be waited when starting or stopping the
|
||||||
* server.
|
* server.
|
||||||
* @param lifecycleTimeout the lefecycle timeout
|
* @param lifecycleTimeout the lifecycle timeout
|
||||||
*/
|
*/
|
||||||
public void setLifecycleTimeout(Duration lifecycleTimeout) {
|
public void setLifecycleTimeout(Duration lifecycleTimeout) {
|
||||||
this.lifecycleTimeout = lifecycleTimeout;
|
this.lifecycleTimeout = lifecycleTimeout;
|
||||||
|
|
|
||||||
|
|
@ -275,15 +275,15 @@ public class ConfigurationPropertiesTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void loadWhenPrefixedPropertiesDecalredAsBeanShouldBind() {
|
public void loadWhenPrefixedPropertiesDeclaredAsBeanShouldBind() {
|
||||||
load(PrefixPropertiesDecalredAsBeanConfiguration.class, "spring.foo.name=foo");
|
load(PrefixPropertiesDeclaredAsBeanConfiguration.class, "spring.foo.name=foo");
|
||||||
PrefixProperties bean = this.context.getBean(PrefixProperties.class);
|
PrefixProperties bean = this.context.getBean(PrefixProperties.class);
|
||||||
assertThat(((BasicProperties) bean).name).isEqualTo("foo");
|
assertThat(((BasicProperties) bean).name).isEqualTo("foo");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void loadWhenPrefixedPropertiesDecalredAsAnnotationValueShouldBind() {
|
public void loadWhenPrefixedPropertiesDeclaredAsAnnotationValueShouldBind() {
|
||||||
load(PrefixPropertiesDecalredAsAnnotationValueConfiguration.class,
|
load(PrefixPropertiesDeclaredAsAnnotationValueConfiguration.class,
|
||||||
"spring.foo.name=foo");
|
"spring.foo.name=foo");
|
||||||
PrefixProperties bean = this.context.getBean(
|
PrefixProperties bean = this.context.getBean(
|
||||||
"spring.foo-" + PrefixProperties.class.getName(), PrefixProperties.class);
|
"spring.foo-" + PrefixProperties.class.getName(), PrefixProperties.class);
|
||||||
|
|
@ -291,8 +291,8 @@ public class ConfigurationPropertiesTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void loadWhenMultiplePrefixedPropertiesDecalredAsAnnotationValueShouldBind() {
|
public void loadWhenMultiplePrefixedPropertiesDeclaredAsAnnotationValueShouldBind() {
|
||||||
load(MultiplePrefixPropertiesDecalredAsAnnotationValueConfiguration.class,
|
load(MultiplePrefixPropertiesDeclaredAsAnnotationValueConfiguration.class,
|
||||||
"spring.foo.name=foo", "spring.bar.name=bar");
|
"spring.foo.name=foo", "spring.bar.name=bar");
|
||||||
PrefixProperties bean1 = this.context.getBean(PrefixProperties.class);
|
PrefixProperties bean1 = this.context.getBean(PrefixProperties.class);
|
||||||
AnotherPrefixProperties bean2 = this.context
|
AnotherPrefixProperties bean2 = this.context
|
||||||
|
|
@ -510,7 +510,7 @@ public class ConfigurationPropertiesTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void loadWhenOverridingPropertiesWithPlaceholderResolutionInEnvionmentShouldBindWithOverride() {
|
public void loadWhenOverridingPropertiesWithPlaceholderResolutionInEnvironmentShouldBindWithOverride() {
|
||||||
MutablePropertySources sources = this.context.getEnvironment()
|
MutablePropertySources sources = this.context.getEnvironment()
|
||||||
.getPropertySources();
|
.getPropertySources();
|
||||||
sources.addFirst(new SystemEnvironmentPropertySource("system",
|
sources.addFirst(new SystemEnvironmentPropertySource("system",
|
||||||
|
|
@ -790,7 +790,7 @@ public class ConfigurationPropertiesTests {
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableConfigurationProperties
|
@EnableConfigurationProperties
|
||||||
static class PrefixPropertiesDecalredAsBeanConfiguration {
|
static class PrefixPropertiesDeclaredAsBeanConfiguration {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public PrefixProperties prefixProperties() {
|
public PrefixProperties prefixProperties() {
|
||||||
|
|
@ -801,14 +801,14 @@ public class ConfigurationPropertiesTests {
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableConfigurationProperties(PrefixProperties.class)
|
@EnableConfigurationProperties(PrefixProperties.class)
|
||||||
static class PrefixPropertiesDecalredAsAnnotationValueConfiguration {
|
static class PrefixPropertiesDeclaredAsAnnotationValueConfiguration {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableConfigurationProperties({ PrefixProperties.class,
|
@EnableConfigurationProperties({ PrefixProperties.class,
|
||||||
AnotherPrefixProperties.class })
|
AnotherPrefixProperties.class })
|
||||||
static class MultiplePrefixPropertiesDecalredAsAnnotationValueConfiguration {
|
static class MultiplePrefixPropertiesDeclaredAsAnnotationValueConfiguration {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ public class BindableTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAnnotationWhenMatchShouldReuturnAnnotation() {
|
public void getAnnotationWhenMatchShouldReturnAnnotation() {
|
||||||
Test annotation = AnnotationUtils.synthesizeAnnotation(Test.class);
|
Test annotation = AnnotationUtils.synthesizeAnnotation(Test.class);
|
||||||
assertThat(Bindable.of(String.class).withAnnotations(annotation)
|
assertThat(Bindable.of(String.class).withAnnotations(annotation)
|
||||||
.getAnnotation(Test.class)).isSameAs(annotation);
|
.getAnnotation(Test.class)).isSameAs(annotation);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue