Merge branch '2.0.x'

This commit is contained in:
Phillip Webb 2018-05-04 16:31:46 -07:00
commit 42c053cf1b
127 changed files with 419 additions and 210 deletions

View File

@ -134,6 +134,7 @@ class CloudFoundryWebEndpointServletHandlerMapping
}
return this.delegate.handle(request, body);
}
}
}

View File

@ -31,7 +31,6 @@ import org.springframework.context.annotation.Configuration;
*
* @author Phillip Webb
* @author Andy Wilkinson
*
* @since 2.0.0
*/
@Configuration

View File

@ -28,11 +28,11 @@ import io.micrometer.core.instrument.config.MeterFilter;
import org.springframework.boot.util.LambdaSafe;
/**
* Configurer to apply {@link MeterRegistryCustomizer customizers},
* {@link MeterFilter filters}, {@link MeterBinder binders} and {@link Metrics#addRegistry
* global registration} to {@link MeterRegistry meter registries}. This configurer
* intentionally skips {@link CompositeMeterRegistry} with the assumptions that the
* registries it contains are beans and will be customized directly.
* Configurer to apply {@link MeterRegistryCustomizer customizers}, {@link MeterFilter
* filters}, {@link MeterBinder binders} and {@link Metrics#addRegistry global
* registration} to {@link MeterRegistry meter registries}. This configurer intentionally
* skips {@link CompositeMeterRegistry} with the assumptions that the registries it
* contains are beans and will be customized directly.
*
* @author Jon Schneider
* @author Phillip Webb

View File

@ -33,6 +33,7 @@ import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties;
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints;
import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPathProvider;
import org.springframework.boot.security.servlet.ApplicationContextRequestMatcher;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
@ -40,6 +41,7 @@ import org.springframework.security.web.util.matcher.OrRequestMatcher;
import org.springframework.security.web.util.matcher.RequestMatcher;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.springframework.web.context.WebApplicationContext;
/**
* Factory that can be used to create a {@link RequestMatcher} for actuator endpoint
@ -114,7 +116,7 @@ public final class EndpointRequest {
* The request matcher used to match against {@link Endpoint actuator endpoints}.
*/
public static final class EndpointRequestMatcher
extends ApplicationContextRequestMatcher<PathMappedEndpoints> {
extends ApplicationContextRequestMatcher<WebApplicationContext> {
private final List<Object> includes;
@ -140,7 +142,7 @@ public final class EndpointRequest {
private EndpointRequestMatcher(List<Object> includes, List<Object> excludes,
boolean includeLinks) {
super(PathMappedEndpoints.class);
super(WebApplicationContext.class);
this.includes = includes;
this.excludes = excludes;
this.includeLinks = includeLinks;
@ -163,32 +165,40 @@ public final class EndpointRequest {
}
@Override
protected void initialized(Supplier<PathMappedEndpoints> pathMappedEndpoints) {
this.delegate = createDelegate(pathMappedEndpoints);
protected void initialized(
Supplier<WebApplicationContext> webApplicationContext) {
this.delegate = createDelegate(webApplicationContext);
}
private RequestMatcher createDelegate(
Supplier<PathMappedEndpoints> pathMappedEndpoints) {
Supplier<WebApplicationContext> webApplicationContext) {
try {
return createDelegate(pathMappedEndpoints.get());
WebApplicationContext context = webApplicationContext.get();
PathMappedEndpoints pathMappedEndpoints = context
.getBean(PathMappedEndpoints.class);
DispatcherServletPathProvider pathProvider = context
.getBean(DispatcherServletPathProvider.class);
return createDelegate(pathMappedEndpoints, pathProvider.getServletPath());
}
catch (NoSuchBeanDefinitionException ex) {
return EMPTY_MATCHER;
}
}
private RequestMatcher createDelegate(PathMappedEndpoints pathMappedEndpoints) {
private RequestMatcher createDelegate(PathMappedEndpoints pathMappedEndpoints,
String servletPath) {
Set<String> paths = new LinkedHashSet<>();
if (this.includes.isEmpty()) {
paths.addAll(pathMappedEndpoints.getAllPaths());
}
streamPaths(this.includes, pathMappedEndpoints).forEach(paths::add);
streamPaths(this.excludes, pathMappedEndpoints).forEach(paths::remove);
List<RequestMatcher> delegateMatchers = getDelegateMatchers(paths);
List<RequestMatcher> delegateMatchers = getDelegateMatchers(servletPath,
paths);
if (this.includeLinks
&& StringUtils.hasText(pathMappedEndpoints.getBasePath())) {
delegateMatchers.add(
new AntPathRequestMatcher(pathMappedEndpoints.getBasePath()));
delegateMatchers.add(new AntPathRequestMatcher(
servletPath + pathMappedEndpoints.getBasePath()));
}
return new OrRequestMatcher(delegateMatchers);
}
@ -216,14 +226,16 @@ public final class EndpointRequest {
return annotation.id();
}
private List<RequestMatcher> getDelegateMatchers(Set<String> paths) {
return paths.stream().map((path) -> new AntPathRequestMatcher(path + "/**"))
private List<RequestMatcher> getDelegateMatchers(String servletPath,
Set<String> paths) {
return paths.stream()
.map((path) -> new AntPathRequestMatcher(servletPath + path + "/**"))
.collect(Collectors.toList());
}
@Override
protected boolean matches(HttpServletRequest request,
Supplier<PathMappedEndpoints> context) {
Supplier<WebApplicationContext> context) {
return this.delegate.matches(request);
}
@ -233,29 +245,41 @@ public final class EndpointRequest {
* The request matcher used to match against the links endpoint.
*/
public static final class LinksRequestMatcher
extends ApplicationContextRequestMatcher<WebEndpointProperties> {
extends ApplicationContextRequestMatcher<WebApplicationContext> {
private RequestMatcher delegate;
private LinksRequestMatcher() {
super(WebEndpointProperties.class);
super(WebApplicationContext.class);
}
@Override
protected void initialized(Supplier<WebEndpointProperties> properties) {
this.delegate = createDelegate(properties.get());
protected void initialized(
Supplier<WebApplicationContext> webApplicationContext) {
try {
WebApplicationContext context = webApplicationContext.get();
WebEndpointProperties properties = context
.getBean(WebEndpointProperties.class);
DispatcherServletPathProvider pathProvider = context
.getBean(DispatcherServletPathProvider.class);
this.delegate = createDelegate(pathProvider.getServletPath(), properties);
}
catch (NoSuchBeanDefinitionException ex) {
this.delegate = EMPTY_MATCHER;
}
}
private RequestMatcher createDelegate(WebEndpointProperties properties) {
private RequestMatcher createDelegate(String path,
WebEndpointProperties properties) {
if (StringUtils.hasText(properties.getBasePath())) {
return new AntPathRequestMatcher(properties.getBasePath());
return new AntPathRequestMatcher(path + properties.getBasePath());
}
return EMPTY_MATCHER;
}
@Override
protected boolean matches(HttpServletRequest request,
Supplier<WebEndpointProperties> context) {
Supplier<WebApplicationContext> context) {
return this.delegate.matches(request);
}

View File

@ -25,6 +25,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type;
import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration;
import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPathProvider;
import org.springframework.boot.web.servlet.error.ErrorAttributes;
import org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter;
import org.springframework.context.annotation.Bean;
@ -92,4 +93,9 @@ class WebMvcEndpointChildContextConfiguration {
return new OrderedRequestContextFilter();
}
@Bean
public DispatcherServletPathProvider childDispatcherServletPathProvider() {
return () -> "";
}
}

View File

@ -71,8 +71,7 @@ public class SignalFxMetricsExportAutoConfigurationTests {
@Test
public void autoConfigurationCanBeDisabled() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues(
"management.metrics.export.signalfx.enabled=false")
.withPropertyValues("management.metrics.export.signalfx.enabled=false")
.run((context) -> assertThat(context)
.doesNotHaveBean(SignalFxMeterRegistry.class)
.doesNotHaveBean(SignalFxConfig.class));

View File

@ -22,7 +22,6 @@ import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
/**
*
* @author Stephane Nicoll
*/
public class SimplePropertiesTests {

View File

@ -30,6 +30,7 @@ import org.springframework.boot.actuate.endpoint.Operation;
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.web.PathMappedEndpoint;
import org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints;
import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPathProvider;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockServletContext;
import org.springframework.security.web.util.matcher.RequestMatcher;
@ -71,6 +72,19 @@ public class EndpointRequestTests {
assertMatcher(matcher).doesNotMatch("/actuator/baz");
}
@Test
public void toAnyEndpointWhenServletPathNotEmptyShouldMatch() {
RequestMatcher matcher = EndpointRequest.toAnyEndpoint();
assertMatcher(matcher, "/actuator", "/spring").matches("/spring",
"/actuator/foo");
assertMatcher(matcher, "/actuator", "/spring").matches("/spring",
"/actuator/bar");
assertMatcher(matcher, "/actuator", "/spring").matches("/spring", "/actuator");
assertMatcher(matcher, "/actuator", "/spring").doesNotMatch("/spring",
"/actuator/baz");
assertMatcher(matcher, "/actuator", "/spring").doesNotMatch("", "/actuator/foo");
}
@Test
public void toEndpointClassShouldMatchEndpointPath() {
RequestMatcher matcher = EndpointRequest.to(FooEndpoint.class);
@ -114,6 +128,14 @@ public class EndpointRequestTests {
assertMatcher.doesNotMatch("/");
}
@Test
public void toLinksWhenServletPathNotEmptyShouldNotMatch() {
RequestMatcher matcher = EndpointRequest.toLinks();
RequestMatcherAssert assertMatcher = assertMatcher(matcher, "/actuator",
"/spring");
assertMatcher.matches("/spring/actuator");
}
@Test
public void excludeByClassShouldNotMatchExcluded() {
RequestMatcher matcher = EndpointRequest.toAnyEndpoint()
@ -179,6 +201,11 @@ public class EndpointRequestTests {
return assertMatcher(matcher, mockPathMappedEndpoints(basePath));
}
private RequestMatcherAssert assertMatcher(RequestMatcher matcher, String basePath,
String servletPath) {
return assertMatcher(matcher, mockPathMappedEndpoints(basePath), servletPath);
}
private PathMappedEndpoints mockPathMappedEndpoints(String basePath) {
List<ExposableEndpoint<?>> endpoints = new ArrayList<>();
endpoints.add(mockEndpoint("foo", "foo"));
@ -195,6 +222,11 @@ public class EndpointRequestTests {
private RequestMatcherAssert assertMatcher(RequestMatcher matcher,
PathMappedEndpoints pathMappedEndpoints) {
return assertMatcher(matcher, pathMappedEndpoints, "");
}
private RequestMatcherAssert assertMatcher(RequestMatcher matcher,
PathMappedEndpoints pathMappedEndpoints, String servletPath) {
StaticWebApplicationContext context = new StaticWebApplicationContext();
context.registerBean(WebEndpointProperties.class);
if (pathMappedEndpoints != null) {
@ -205,6 +237,8 @@ public class EndpointRequestTests {
properties.setBasePath(pathMappedEndpoints.getBasePath());
}
}
DispatcherServletPathProvider pathProvider = () -> servletPath;
context.registerBean(DispatcherServletPathProvider.class, () -> pathProvider);
return assertThat(new RequestMatcherAssert(context, matcher));
}
@ -219,8 +253,12 @@ public class EndpointRequestTests {
this.matcher = matcher;
}
public void matches(String path) {
matches(mockRequest(path));
public void matches(String servletPath) {
matches(mockRequest(servletPath));
}
public void matches(String servletPath, String pathInfo) {
matches(mockRequest(servletPath, pathInfo));
}
private void matches(HttpServletRequest request) {
@ -228,8 +266,12 @@ public class EndpointRequestTests {
.as("Matches " + getRequestPath(request)).isTrue();
}
public void doesNotMatch(String path) {
doesNotMatch(mockRequest(path));
public void doesNotMatch(String servletPath) {
doesNotMatch(mockRequest(servletPath));
}
public void doesNotMatch(String servletPath, String pathInfo) {
doesNotMatch(mockRequest(servletPath, pathInfo));
}
private void doesNotMatch(HttpServletRequest request) {
@ -237,8 +279,8 @@ public class EndpointRequestTests {
.as("Does not match " + getRequestPath(request)).isFalse();
}
private MockHttpServletRequest mockRequest(String path) {
return mockRequest(null, path);
private MockHttpServletRequest mockRequest(String servletPath) {
return mockRequest(servletPath, null);
}
private MockHttpServletRequest mockRequest(String servletPath, String path) {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -18,6 +18,7 @@ package org.springframework.boot.actuate.autoconfigure.web.servlet;
import org.junit.Test;
import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPathProvider;
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
import org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter;
import org.springframework.context.annotation.Bean;
@ -62,6 +63,15 @@ public class WebMvcEndpointChildContextConfigurationTests {
});
}
@Test
public void contextShouldConfigureDispatcherServletPathProviderWithEmptyPath() {
this.contextRunner
.withUserConfiguration(WebMvcEndpointChildContextConfiguration.class)
.run((context) -> assertThat(context
.getBean(DispatcherServletPathProvider.class).getServletPath())
.isEmpty());
}
static class ExistingConfig {
@Bean

View File

@ -44,7 +44,6 @@ public class BeansEndpoint {
/**
* Creates a new {@code BeansEndpoint} that will describe the beans in the given
* {@code context} and all of its ancestors.
*
* @param context the application context
* @see ConfigurableApplicationContext#getParent()
*/

View File

@ -335,6 +335,7 @@ public class ConfigurationPropertiesReportEndpoint implements ApplicationContext
}
super.serializeAsField(pojo, jgen, provider, writer);
}
}
/**

View File

@ -51,4 +51,5 @@ public final class MissingParametersException extends InvalidEndpointRequestExce
public Set<OperationParameter> getMissingParameters() {
return this.missingParameters;
}
}

View File

@ -107,8 +107,8 @@ public class EndpointMBean implements DynamicMBean {
return this.responseMapper.mapResponse(result);
}
catch (InvalidEndpointRequestException ex) {
throw new ReflectionException(new IllegalArgumentException(
ex.getMessage()), ex.getMessage());
throw new ReflectionException(new IllegalArgumentException(ex.getMessage()),
ex.getMessage());
}
catch (Exception ex) {
throw new MBeanException(translateIfNecessary(ex), ex.getMessage());

View File

@ -210,4 +210,5 @@ class DiscoveredJmxOperation extends AbstractDiscoveredOperation implements JmxO
}
}
}

View File

@ -30,7 +30,6 @@ public class EndpointMapping {
/**
* Creates a new {@code EndpointMapping} using the given {@code path}.
*
* @param path the path
*/
public EndpointMapping(String path) {

View File

@ -44,4 +44,5 @@ class DiscoveredWebEndpoint extends AbstractDiscoveredEndpoint<WebOperation>
public String getRootPath() {
return this.rootPath;
}
}

View File

@ -251,6 +251,7 @@ public abstract class AbstractWebFluxEndpointHandlerMapping
Mono<ResponseEntity<Object>> handle(ServerWebExchange exchange,
Map<String, String> body);
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -173,6 +173,7 @@ public class MetricsEndpoint {
public Set<String> getNames() {
return this.names;
}
}
/**
@ -228,6 +229,7 @@ public class MetricsEndpoint {
public Set<String> getValues() {
return this.values;
}
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -61,18 +61,17 @@ public class MetricsWebFilter implements WebFilter {
private Publisher<Void> filter(ServerWebExchange exchange, Mono<Void> call) {
long start = System.nanoTime();
ServerHttpResponse response = exchange.getResponse();
return call.doOnSuccess((done) -> success(exchange, start))
.doOnError((cause) -> {
if (response.isCommitted()) {
error(exchange, start, cause);
}
else {
response.beforeCommit(() -> {
error(exchange, start, cause);
return Mono.empty();
});
}
return call.doOnSuccess((done) -> success(exchange, start)).doOnError((cause) -> {
if (response.isCommitted()) {
error(exchange, start, cause);
}
else {
response.beforeCommit(() -> {
error(exchange, start, cause);
return Mono.empty();
});
}
});
}
private void success(ServerWebExchange exchange, long start) {

View File

@ -31,7 +31,6 @@ public interface MappingDescriptionProvider {
/**
* Returns the name of the mappings described by this provider.
*
* @return the name of the mappings
*/
String getMappingName();

View File

@ -40,7 +40,6 @@ public class FilterRegistrationMappingDescription
/**
* Returns the servlet name mappings for the registered filter.
*
* @return the mappings
*/
public Collection<String> getServletNameMappings() {
@ -49,7 +48,6 @@ public class FilterRegistrationMappingDescription
/**
* Returns the URL pattern mappings for the registered filter.
*
* @return the mappings
*/
public Collection<String> getUrlPatternMappings() {

View File

@ -40,7 +40,6 @@ public class RegistrationMappingDescription<T extends Registration> {
/**
* Returns the name of the registered Filter or Servlet.
*
* @return the name
*/
public String getName() {
@ -49,7 +48,6 @@ public class RegistrationMappingDescription<T extends Registration> {
/**
* Returns the class name of the registered Filter or Servlet.
*
* @return the class name
*/
public String getClassName() {

View File

@ -41,7 +41,6 @@ public class ServletRegistrationMappingDescription
/**
* Returns the mappings for the registered servlet.
*
* @return the mappings
*/
public Collection<String> getMappings() {

View File

@ -81,4 +81,5 @@ public class OperationMethodTests {
String example(String name) {
return name;
}
}

View File

@ -32,4 +32,5 @@ class TestJmxOperationResponseMapper implements JmxOperationResponseMapper {
public Class<?> mapResponseType(Class<?> responseType) {
return responseType;
}
}

View File

@ -57,16 +57,17 @@ public class ControllerEndpointDiscovererTests {
@Test
public void getEndpointsWhenNoEndpointBeansShouldReturnEmptyCollection() {
this.contextRunner.withUserConfiguration(EmptyConfiguration.class).run(
assertDiscoverer((discoverer) ->
assertThat(discoverer.getEndpoints()).isEmpty()));
this.contextRunner.withUserConfiguration(EmptyConfiguration.class)
.run(assertDiscoverer(
(discoverer) -> assertThat(discoverer.getEndpoints()).isEmpty()));
}
@Test
public void getEndpointsShouldIncludeControllerEndpoints() {
this.contextRunner.withUserConfiguration(TestControllerEndpoint.class)
.run(assertDiscoverer((discoverer) -> {
Collection<ExposableControllerEndpoint> endpoints = discoverer.getEndpoints();
Collection<ExposableControllerEndpoint> endpoints = discoverer
.getEndpoints();
assertThat(endpoints).hasSize(1);
ExposableControllerEndpoint endpoint = endpoints.iterator().next();
assertThat(endpoint.getId()).isEqualTo("testcontroller");
@ -79,10 +80,11 @@ public class ControllerEndpointDiscovererTests {
@Test
public void getEndpointsShouldDiscoverProxyControllerEndpoints() {
this.contextRunner.withUserConfiguration(TestProxyControllerEndpoint.class)
.withConfiguration(AutoConfigurations.of(
ValidationAutoConfiguration.class))
.withConfiguration(
AutoConfigurations.of(ValidationAutoConfiguration.class))
.run(assertDiscoverer((discoverer) -> {
Collection<ExposableControllerEndpoint> endpoints = discoverer.getEndpoints();
Collection<ExposableControllerEndpoint> endpoints = discoverer
.getEndpoints();
assertThat(endpoints).hasSize(1);
ExposableControllerEndpoint endpoint = endpoints.iterator().next();
assertThat(endpoint.getId()).isEqualTo("testcontroller");
@ -96,7 +98,8 @@ public class ControllerEndpointDiscovererTests {
public void getEndpointsShouldIncludeRestControllerEndpoints() {
this.contextRunner.withUserConfiguration(TestRestControllerEndpoint.class)
.run(assertDiscoverer((discoverer) -> {
Collection<ExposableControllerEndpoint> endpoints = discoverer.getEndpoints();
Collection<ExposableControllerEndpoint> endpoints = discoverer
.getEndpoints();
assertThat(endpoints).hasSize(1);
ExposableControllerEndpoint endpoint = endpoints.iterator().next();
assertThat(endpoint.getId()).isEqualTo("testrestcontroller");
@ -108,10 +111,11 @@ public class ControllerEndpointDiscovererTests {
@Test
public void getEndpointsShouldDiscoverProxyRestControllerEndpoints() {
this.contextRunner.withUserConfiguration(TestProxyRestControllerEndpoint.class)
.withConfiguration(AutoConfigurations.of(
ValidationAutoConfiguration.class))
.withConfiguration(
AutoConfigurations.of(ValidationAutoConfiguration.class))
.run(assertDiscoverer((discoverer) -> {
Collection<ExposableControllerEndpoint> endpoints = discoverer.getEndpoints();
Collection<ExposableControllerEndpoint> endpoints = discoverer
.getEndpoints();
assertThat(endpoints).hasSize(1);
ExposableControllerEndpoint endpoint = endpoints.iterator().next();
assertThat(endpoint.getId()).isEqualTo("testrestcontroller");
@ -125,7 +129,8 @@ public class ControllerEndpointDiscovererTests {
public void getEndpointsShouldNotDiscoverRegularEndpoints() {
this.contextRunner.withUserConfiguration(WithRegularEndpointConfiguration.class)
.run(assertDiscoverer((discoverer) -> {
Collection<ExposableControllerEndpoint> endpoints = discoverer.getEndpoints();
Collection<ExposableControllerEndpoint> endpoints = discoverer
.getEndpoints();
List<String> ids = endpoints.stream().map(ExposableEndpoint::getId)
.collect(Collectors.toList());
assertThat(ids).containsOnly("testcontroller", "testrestcontroller");
@ -137,7 +142,8 @@ public class ControllerEndpointDiscovererTests {
this.contextRunner.withUserConfiguration(TestControllerWithOperation.class)
.run(assertDiscoverer((discoverer) -> {
this.thrown.expect(IllegalStateException.class);
this.thrown.expectMessage("ControllerEndpoints must not declare operations");
this.thrown.expectMessage(
"ControllerEndpoints must not declare operations");
discoverer.getEndpoints();
}));
}

View File

@ -67,15 +67,16 @@ public class ServletEndpointDiscovererTests {
@Test
public void getEndpointsWhenNoEndpointBeansShouldReturnEmptyCollection() {
this.contextRunner.withUserConfiguration(EmptyConfiguration.class)
.run(assertDiscoverer((discoverer)
-> assertThat(discoverer.getEndpoints()).isEmpty()));
.run(assertDiscoverer(
(discoverer) -> assertThat(discoverer.getEndpoints()).isEmpty()));
}
@Test
public void getEndpointsShouldIncludeServletEndpoints() {
this.contextRunner.withUserConfiguration(TestServletEndpoint.class)
.run(assertDiscoverer((discoverer) -> {
Collection<ExposableServletEndpoint> endpoints = discoverer.getEndpoints();
Collection<ExposableServletEndpoint> endpoints = discoverer
.getEndpoints();
assertThat(endpoints).hasSize(1);
ExposableServletEndpoint endpoint = endpoints.iterator().next();
assertThat(endpoint.getId()).isEqualTo("testservlet");
@ -87,9 +88,11 @@ public class ServletEndpointDiscovererTests {
@Test
public void getEndpointsShouldDiscoverProxyServletEndpoints() {
this.contextRunner.withUserConfiguration(TestProxyServletEndpoint.class)
.withConfiguration(AutoConfigurations.of(ValidationAutoConfiguration.class))
.withConfiguration(
AutoConfigurations.of(ValidationAutoConfiguration.class))
.run(assertDiscoverer((discoverer) -> {
Collection<ExposableServletEndpoint> endpoints = discoverer.getEndpoints();
Collection<ExposableServletEndpoint> endpoints = discoverer
.getEndpoints();
assertThat(endpoints).hasSize(1);
ExposableServletEndpoint endpoint = endpoints.iterator().next();
assertThat(endpoint.getId()).isEqualTo("testservlet");
@ -102,7 +105,8 @@ public class ServletEndpointDiscovererTests {
public void getEndpointsShouldNotDiscoverRegularEndpoints() {
this.contextRunner.withUserConfiguration(WithRegularEndpointConfiguration.class)
.run(assertDiscoverer((discoverer) -> {
Collection<ExposableServletEndpoint> endpoints = discoverer.getEndpoints();
Collection<ExposableServletEndpoint> endpoints = discoverer
.getEndpoints();
List<String> ids = endpoints.stream().map(ExposableEndpoint::getId)
.collect(Collectors.toList());
assertThat(ids).containsOnly("testservlet");
@ -114,7 +118,8 @@ public class ServletEndpointDiscovererTests {
this.contextRunner.withUserConfiguration(TestServletEndpointWithOperation.class)
.run(assertDiscoverer((discoverer) -> {
this.thrown.expect(IllegalStateException.class);
this.thrown.expectMessage("ServletEndpoints must not declare operations");
this.thrown.expectMessage(
"ServletEndpoints must not declare operations");
discoverer.getEndpoints();
}));
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -27,4 +27,5 @@ import org.springframework.context.ConfigurableApplicationContext;
interface ContextFactory {
ConfigurableApplicationContext createContext(List<Class<?>> configurationClasses);
}

View File

@ -32,6 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for {@link MetricsWebFilter}
*
* @author Brian Clozel
*/
public class MetricsWebFilterTests {

View File

@ -331,4 +331,5 @@ public class HttpExchangeTracerTests {
}
return output.toString();
}
}

View File

@ -458,6 +458,7 @@ public class RabbitProperties {
public void setCheckoutTimeout(Duration checkoutTimeout) {
this.checkoutTimeout = checkoutTimeout;
}
}
public static class Connection {

View File

@ -75,8 +75,7 @@ public class CacheAutoConfiguration {
@Bean
public CacheManagerValidator cacheAutoConfigurationValidator(
CacheProperties cacheProperties,
ObjectProvider<CacheManager> cacheManager) {
CacheProperties cacheProperties, ObjectProvider<CacheManager> cacheManager) {
return new CacheManagerValidator(cacheProperties, cacheManager);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -77,4 +77,5 @@ class FreeMarkerServletWebConfiguration extends AbstractFreeMarkerConfiguration
public ResourceUrlEncodingFilter resourceUrlEncodingFilter() {
return new ResourceUrlEncodingFilter();
}
}

View File

@ -34,4 +34,5 @@ public interface GsonBuilderCustomizer {
* @param gsonBuilder the GsonBuilder to customize
*/
void customize(GsonBuilder gsonBuilder);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -62,8 +62,8 @@ class DataSourceBeanCreationFailureAnalyzer
if (!StringUtils.hasText(cause.getProperties().getUrl())) {
description.append("'url' attribute is not specified and ");
}
description.append(
String.format("no embedded datasource could be configured.%n"));
description
.append(String.format("no embedded datasource could be configured.%n"));
description.append(String.format("%nReason: %s%n", cause.getMessage()));
return description.toString();
}

View File

@ -142,6 +142,7 @@ public final class StaticResourceRequest {
getDelegateMatchers());
return matcher.matches(exchange);
}
}
}

View File

@ -191,6 +191,7 @@ public class SessionAutoConfiguration {
// Ignore
}
}
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -75,6 +75,7 @@ public class TransactionAutoConfiguration {
public TransactionTemplate transactionTemplate() {
return new TransactionTemplate(this.transactionManager);
}
}
@Configuration

View File

@ -957,6 +957,7 @@ public class ServerProperties {
public void setLogLatency(boolean logLatency) {
this.logLatency = logLatency;
}
}
}

View File

@ -88,8 +88,12 @@ public class DispatcherServletAutoConfiguration {
private final WebMvcProperties webMvcProperties;
public DispatcherServletConfiguration(WebMvcProperties webMvcProperties) {
private final ServerProperties serverProperties;
public DispatcherServletConfiguration(WebMvcProperties webMvcProperties,
ServerProperties serverProperties) {
this.webMvcProperties = webMvcProperties;
this.serverProperties = serverProperties;
}
@Bean(name = DEFAULT_DISPATCHER_SERVLET_BEAN_NAME)
@ -112,6 +116,12 @@ public class DispatcherServletAutoConfiguration {
return resolver;
}
@Bean
public DispatcherServletPathProvider mainDispatcherServletPathProvider() {
return () -> DispatcherServletConfiguration.this.serverProperties.getServlet()
.getPath();
}
}
@Configuration

View File

@ -0,0 +1,33 @@
/*
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.web.servlet;
import org.springframework.web.servlet.DispatcherServlet;
/**
* Interface that provides the path of the {@link DispatcherServlet} in an application
* context.
*
* @author Madhura Bhave
* @since 2.0.2
*/
@FunctionalInterface
public interface DispatcherServletPathProvider {
String getServletPath();
}

View File

@ -752,11 +752,10 @@ public class CacheAutoConfigurationTests extends AbstractCacheAutoConfigurationT
public void autoConfiguredCacheManagerCanBeSwapped() {
this.contextRunner
.withUserConfiguration(CacheManagerPostProcessorConfiguration.class)
.withPropertyValues("spring.cache.type=caffeine")
.run((context) -> {
.withPropertyValues("spring.cache.type=caffeine").run((context) -> {
getCacheManager(context, SimpleCacheManager.class);
CacheManagerPostProcessor postProcessor = context.getBean(
CacheManagerPostProcessor.class);
CacheManagerPostProcessor postProcessor = context
.getBean(CacheManagerPostProcessor.class);
assertThat(postProcessor.cacheManagers).hasSize(1);
assertThat(postProcessor.cacheManagers.get(0))
.isInstanceOf(CaffeineCacheManager.class);
@ -1043,14 +1042,12 @@ public class CacheAutoConfigurationTests extends AbstractCacheAutoConfigurationT
private final List<CacheManager> cacheManagers = new ArrayList<>();
@Override
public Object postProcessBeforeInitialization(Object bean,
String beanName) {
public Object postProcessBeforeInitialization(Object bean, String beanName) {
return bean;
}
@Override
public Object postProcessAfterInitialization(Object bean,
String beanName) {
public Object postProcessAfterInitialization(Object bean, String beanName) {
if (bean instanceof CacheManager) {
this.cacheManagers.add((CacheManager) bean);
return new SimpleCacheManager();

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -158,6 +158,7 @@ public class CassandraDataAutoConfigurationTests {
public String convert(Person o) {
return null;
}
}
private static class Person {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -186,6 +186,7 @@ public class CouchbaseDataAutoConfigurationTests {
public Boolean convert(CouchbaseProperties value) {
return true;
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -76,6 +76,7 @@ public class ElasticsearchNodeTemplate {
Arrays.asList(Netty4Plugin.class));
new File("target/es/node/logs").mkdirs();
}
}
public final class ElasticsearchNode {

View File

@ -291,6 +291,7 @@ public class GsonAutoConfigurationTests {
private String data = "nested";
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -80,16 +80,16 @@ public class IntegrationAutoConfigurationTests {
.withUserConfiguration(CustomIntegrationComponentScanConfiguration.class)
.run((context) -> {
assertThat(context).hasSingleBean(TestGateway.class);
assertThat(context).doesNotHaveBean(
IntegrationComponentScanConfiguration.class);
assertThat(context)
.doesNotHaveBean(IntegrationComponentScanConfiguration.class);
});
}
@Test
public void noMBeanServerAvailable() {
ApplicationContextRunner contextRunnerWithoutJmx = new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(
IntegrationAutoConfiguration.class));
.withConfiguration(
AutoConfigurations.of(IntegrationAutoConfiguration.class));
contextRunnerWithoutJmx.run((context) -> {
assertThat(context).hasSingleBean(TestGateway.class);
assertThat(context)

View File

@ -232,6 +232,7 @@ public class ActiveMQAutoConfigurationTests {
factory.setUserName("foobar");
};
}
}
}

View File

@ -96,4 +96,5 @@ public class ArtemisEmbeddedConfigurationFactoryTests {
.getAddressConfigurations();
assertThat(addressConfigurations).hasSize(2);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -55,6 +55,7 @@ public class JsonbAutoConfigurationTests {
public void setData(String data) {
this.data = data;
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -127,6 +127,7 @@ public class MustacheAutoConfigurationTests {
return Mustache.compiler().standardsMode(true)
.withLoader(mustacheTemplateLoader);
}
}
}

View File

@ -87,21 +87,24 @@ public class QuartzAutoConfigurationTests {
@Test
public void withDataSourceUseMemoryByDefault() {
this.contextRunner.withConfiguration(AutoConfigurations.of(
DataSourceAutoConfiguration.class,
DataSourceTransactionManagerAutoConfiguration.class)).run((context) -> {
assertThat(context).hasSingleBean(Scheduler.class);
Scheduler scheduler = context.getBean(Scheduler.class);
assertThat(scheduler.getMetaData().getJobStoreClass())
.isAssignableFrom(RAMJobStore.class);
});
this.contextRunner
.withConfiguration(
AutoConfigurations.of(DataSourceAutoConfiguration.class,
DataSourceTransactionManagerAutoConfiguration.class))
.run((context) -> {
assertThat(context).hasSingleBean(Scheduler.class);
Scheduler scheduler = context.getBean(Scheduler.class);
assertThat(scheduler.getMetaData().getJobStoreClass())
.isAssignableFrom(RAMJobStore.class);
});
}
@Test
public void withDataSource() {
this.contextRunner.withUserConfiguration(QuartzJobsConfiguration.class)
.withConfiguration(AutoConfigurations.of(DataSourceAutoConfiguration.class,
DataSourceTransactionManagerAutoConfiguration.class))
.withConfiguration(
AutoConfigurations.of(DataSourceAutoConfiguration.class,
DataSourceTransactionManagerAutoConfiguration.class))
.withPropertyValues("spring.quartz.job-store-type=jdbc")
.run(assertDataSourceJobStore("dataSource"));
}
@ -109,8 +112,8 @@ public class QuartzAutoConfigurationTests {
@Test
public void withDataSourceNoTransactionManager() {
this.contextRunner.withUserConfiguration(QuartzJobsConfiguration.class)
.withConfiguration(AutoConfigurations.of(
DataSourceAutoConfiguration.class))
.withConfiguration(
AutoConfigurations.of(DataSourceAutoConfiguration.class))
.withPropertyValues("spring.quartz.job-store-type=jdbc")
.run(assertDataSourceJobStore("dataSource"));
}
@ -131,13 +134,13 @@ public class QuartzAutoConfigurationTests {
Scheduler scheduler = context.getBean(Scheduler.class);
assertThat(scheduler.getMetaData().getJobStoreClass())
.isAssignableFrom(LocalDataSourceJobStore.class);
JdbcTemplate jdbcTemplate = new JdbcTemplate(context.getBean(
datasourceName, DataSource.class));
JdbcTemplate jdbcTemplate = new JdbcTemplate(
context.getBean(datasourceName, DataSource.class));
assertThat(jdbcTemplate.queryForObject(
"SELECT COUNT(*) FROM QRTZ_JOB_DETAILS", Integer.class)).isEqualTo(2);
assertThat(jdbcTemplate.queryForObject(
"SELECT COUNT(*) FROM QRTZ_SIMPLE_TRIGGERS", Integer.class))
.isEqualTo(0);
.isEqualTo(0);
};
}
@ -185,8 +188,9 @@ public class QuartzAutoConfigurationTests {
@Test
public void withQuartzProperties() {
this.contextRunner.withPropertyValues(
"spring.quartz.properties.org.quartz.scheduler.instanceId=FOO")
this.contextRunner
.withPropertyValues(
"spring.quartz.properties.org.quartz.scheduler.instanceId=FOO")
.run((context) -> {
assertThat(context).hasSingleBean(Scheduler.class);
Scheduler scheduler = context.getBean(Scheduler.class);
@ -204,8 +208,6 @@ public class QuartzAutoConfigurationTests {
});
}
@Import(ComponentThatUsesScheduler.class)
@Configuration
protected static class BaseQuartzConfiguration {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -203,6 +203,7 @@ public class TransactionAutoConfigurationTests {
public AnotherServiceImpl anotherService() {
return new AnotherServiceImpl();
}
}
@Configuration

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -304,6 +304,7 @@ public class ValidationAutoConfigurationTests {
interface AnotherSampleService {
void doSomething(@Min(42) Integer counter);
}
@Validated
@ -313,6 +314,7 @@ public class ValidationAutoConfigurationTests {
public void doSomething(Integer counter) {
}
}
@Configuration
@ -382,6 +384,7 @@ public class ValidationAutoConfigurationTests {
}
}
}
}

View File

@ -373,6 +373,7 @@ public class WebFluxAutoConfigurationTests {
public CodecCustomizer firstCodecCustomizer() {
return mock(CodecCustomizer.class);
}
}
@Configuration
@ -388,6 +389,7 @@ public class WebFluxAutoConfigurationTests {
public ViewResolver anotherViewResolver() {
return mock(ViewResolver.class);
}
}
@Configuration
@ -407,6 +409,7 @@ public class WebFluxAutoConfigurationTests {
public HttpHandler httpHandler() {
return (serverHttpRequest, serverHttpResponse) -> null;
}
}
@Configuration

View File

@ -311,6 +311,7 @@ public class DefaultErrorWebExceptionHandlerIntegrationTests {
public String bodyValidation(@Valid @RequestBody DummyBody body) {
return body.getContent();
}
}
}

View File

@ -107,6 +107,8 @@ public class DispatcherServletAutoConfigurationTests {
assertThat(registration.getUrlMappings().toString())
.isEqualTo("[/spring/*]");
assertThat(registration.getMultipartConfig()).isNull();
assertThat(context.getBean(DispatcherServletPathProvider.class)
.getServletPath()).isEqualTo("/spring");
});
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -109,4 +109,5 @@ public class TomcatServletWebServerFactoryCustomizerTests {
this.customizer.customize(factory);
return factory;
}
}

View File

@ -829,12 +829,13 @@ public class WebMvcAutoConfigurationTests {
@Test
public void contentNegotiationStrategySkipsPathExtension() throws Exception {
ContentNegotiationStrategy delegate = mock(ContentNegotiationStrategy.class);
ContentNegotiationStrategy strategy = new WebMvcAutoConfiguration
.OptionalPathExtensionContentNegotiationStrategy(delegate);
ContentNegotiationStrategy strategy = new WebMvcAutoConfiguration.OptionalPathExtensionContentNegotiationStrategy(
delegate);
MockHttpServletRequest request = new MockHttpServletRequest();
request.setAttribute(PathExtensionContentNegotiationStrategy.class
.getName() + ".SKIP", Boolean.TRUE);
request.setAttribute(
PathExtensionContentNegotiationStrategy.class.getName() + ".SKIP",
Boolean.TRUE);
ServletWebRequest webRequest = new ServletWebRequest(request);
List<MediaType> mediaTypes = strategy.resolveMediaTypes(webRequest);
assertThat(mediaTypes).containsOnly(MediaType.ALL);

View File

@ -68,8 +68,7 @@ public class WelcomePageHandlerMappingTests {
.run((context) -> {
WelcomePageHandlerMapping handler = context
.getBean(WelcomePageHandlerMapping.class);
assertThat(handler.getOrder())
.isEqualTo(2);
assertThat(handler.getOrder()).isEqualTo(2);
});
}

View File

@ -359,7 +359,8 @@ class ProjectGenerationRequest {
return builder.build();
}
catch (URISyntaxException ex) {
throw new ReportableException("Invalid service URL (" + ex.getMessage() + ")");
throw new ReportableException(
"Invalid service URL (" + ex.getMessage() + ")");
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -42,4 +42,5 @@ public class JestClientCustomizationExample {
}
// end::customizer[]
}

View File

@ -36,6 +36,7 @@ public class UserServiceAutoConfigurationTests {
// tag::runner[]
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(UserServiceAutoConfiguration.class));
// end::runner[]
// tag::test-env[]

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -69,4 +69,5 @@ class DataNeo4jTypeExcludeFilter extends AnnotationCustomizableTypeExcludeFilter
protected Set<Class<?>> getComponentIncludes() {
return Collections.emptySet();
}
}

View File

@ -26,8 +26,7 @@ import org.springframework.util.ClassUtils;
/**
* A {@link TestExecutionListener} for Spring REST Docs that removes the need for a
* {@code @Rule} when using JUnit or manual before and after test calls when using
* TestNG.
* {@code @Rule} when using JUnit or manual before and after test calls when using TestNG.
*
* @author Andy Wilkinson
* @since 1.4.0

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -39,4 +39,5 @@ public class ExampleEntry {
public void setDn(Name dn) {
this.dn = dn;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -24,4 +24,5 @@ import org.springframework.data.neo4j.repository.Neo4jRepository;
* @author Eddú Meléndez
*/
public interface ExampleRepository extends Neo4jRepository<ExampleGraph, Long> {
}

View File

@ -123,4 +123,5 @@ public class FilteredClassLoader extends URLClassLoader {
}
}
}

View File

@ -353,6 +353,7 @@ class ImportsContextCustomizer implements ContextCustomizer {
public String toString() {
return this.key.toString();
}
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -123,6 +123,7 @@ public class JsonbTester<T> extends AbstractJsonMarshalTester<T> {
Class<?> resourceLoadClass, ResolvableType type, Jsonb marshaller) {
return new JsonbTester<>(resourceLoadClass, type, marshaller);
}
}
}

View File

@ -419,6 +419,7 @@ public class ApplicationContextAssertTests {
}
private static class Foo {
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -30,4 +30,5 @@ public class TestMethodConfiguration {
public Object method() {
return null;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -29,4 +29,5 @@ import java.io.OutputStream;
@TestConditionalOnClass(name = "java.io.InputStream", value = OutputStream.class)
@TestAutoConfigureOrder(123)
public class TestOrderedClassConfiguration {
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -151,8 +151,8 @@ public class ConfigurationMetadata {
}
candidates.removeIf((itemMetadata) -> !itemMetadata.hasSameType(metadata));
if (candidates.size() > 1 && metadata.getType() != null) {
candidates.removeIf((itemMetadata) ->
!metadata.getType().equals(itemMetadata.getType()));
candidates.removeIf(
(itemMetadata) -> !metadata.getType().equals(itemMetadata.getType()));
}
if (candidates.size() == 1) {
return candidates.get(0);

View File

@ -742,8 +742,8 @@ public class ConfigurationMetadataAnnotationProcessorTests {
"java.lang.String", null, null, null, null, null);
writeAdditionalMetadata(property);
ConfigurationMetadata metadata = compile(SimpleProperties.class);
assertThat(metadata).has(Metadata.withGroup("simple")
.fromSource(SimpleProperties.class));
assertThat(metadata)
.has(Metadata.withGroup("simple").fromSource(SimpleProperties.class));
assertThat(metadata).has(Metadata.withProperty("simple", String.class));
}

View File

@ -57,8 +57,10 @@ public interface RandomAccessData {
* @param length the number of bytes to be read
* @return the data
* @throws IOException if the data cannot be read
* @throws IndexOutOfBoundsException if offset is beyond the end of the file or subsection
* @throws EOFException if offset plus length is greater than the length of the file or subsection
* @throws IndexOutOfBoundsException if offset is beyond the end of the file or
* subsection
* @throws EOFException if offset plus length is greater than the length of the file
* or subsection
*/
byte[] read(long offset, long length) throws IOException;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -110,20 +110,23 @@ public class RandomAccessDataFileTests {
}
@Test
public void readWhenOffsetIsBeyondEndOfSubsectionShouldThrowException() throws Exception {
public void readWhenOffsetIsBeyondEndOfSubsectionShouldThrowException()
throws Exception {
this.thrown.expect(IndexOutOfBoundsException.class);
RandomAccessData subsection = this.file.getSubsection(0, 10);
subsection.read(11, 0);
}
@Test
public void readWhenOffsetPlusLengthGreaterThanEOFShouldThrowException() throws Exception {
public void readWhenOffsetPlusLengthGreaterThanEOFShouldThrowException()
throws Exception {
this.thrown.expect(EOFException.class);
this.file.read(256, 1);
}
@Test
public void readWhenOffsetPlusLengthGreaterThanEndOfSubsectionShouldThrowException() throws Exception {
public void readWhenOffsetPlusLengthGreaterThanEndOfSubsectionShouldThrowException()
throws Exception {
this.thrown.expect(EOFException.class);
RandomAccessData subsection = this.file.getSubsection(0, 10);
subsection.read(10, 1);

View File

@ -199,4 +199,5 @@ public class AsciiBytesTests {
private void matchesSameAsString(String input) {
assertThat(new AsciiBytes(input).matches(input, NO_SUFFIX)).isTrue();
}
}

View File

@ -167,6 +167,7 @@ public final class PropertyMapper {
/**
* A source that is in the process of being mapped.
*
* @param <T> the source type
*/
public static final class Source<T> {

View File

@ -91,6 +91,7 @@ abstract class AggregateBinder<T> {
/**
* Internal class used to supply the aggregate and cache the value.
*
* @param <T> The aggregate type
*/
protected static class AggregateSupplier<T> {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

Some files were not shown because too many files have changed in this diff Show More