Commit a4bcd20b authored by Phillip Webb's avatar Phillip Webb

Merge branch '1.5.x'

parents d1d70b02 ca1540ce
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -117,10 +117,9 @@ class CloudFoundrySecurityService { ...@@ -117,10 +117,9 @@ class CloudFoundrySecurityService {
private Map<String, String> extractTokenKeys(Map<?, ?> response) { private Map<String, String> extractTokenKeys(Map<?, ?> response) {
Map<String, String> tokenKeys = new HashMap<String, String>(); Map<String, String> tokenKeys = new HashMap<String, String>();
List<?> keys = (List<?>) response.get("keys"); for (Object key : (List<?>) response.get("keys")) {
for (Object key : keys) {
Map<?, ?> tokenKey = (Map<?, ?>) key; Map<?, ?> tokenKey = (Map<?, ?>) key;
tokenKeys.put((String) (tokenKey).get("kid"), (String) (tokenKey).get("value")); tokenKeys.put((String) tokenKey.get("kid"), (String) tokenKey.get("value"));
} }
return tokenKeys; return tokenKeys;
} }
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -97,7 +97,6 @@ class Token { ...@@ -97,7 +97,6 @@ class Token {
return getRequired(this.claims, "scope", List.class); return getRequired(this.claims, "scope", List.class);
} }
@SuppressWarnings("unchecked")
public String getKeyId() { public String getKeyId() {
return getRequired(this.header, "kid", String.class); return getRequired(this.header, "kid", String.class);
} }
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -52,8 +52,6 @@ class TokenValidator { ...@@ -52,8 +52,6 @@ class TokenValidator {
validateAudience(token); validateAudience(token);
} }
private void validateAlgorithm(Token token) { private void validateAlgorithm(Token token) {
String algorithm = token.getSignatureAlgorithm(); String algorithm = token.getSignatureAlgorithm();
if (algorithm == null) { if (algorithm == null) {
...@@ -83,9 +81,9 @@ class TokenValidator { ...@@ -83,9 +81,9 @@ class TokenValidator {
} }
} }
private boolean hasValidKeyId(String tokenKeyId) { private boolean hasValidKeyId(String tokenKey) {
for (String keyId: this.tokenKeys.keySet()) { for (String candidate : this.tokenKeys.keySet()) {
if (tokenKeyId.equals(keyId)) { if (tokenKey.equals(candidate)) {
return true; return true;
} }
} }
......
/* /*
* Copyright 2012-2015 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2014 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2015 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -85,7 +85,8 @@ public class TokenValidatorTests { ...@@ -85,7 +85,8 @@ public class TokenValidatorTests {
private static final Map<String, String> INVALID_KEYS = Collections private static final Map<String, String> INVALID_KEYS = Collections
.singletonMap("invalid-key", INVALID_KEY); .singletonMap("invalid-key", INVALID_KEY);
private static final Map<String, String> VALID_KEYS = Collections.singletonMap("valid-key", VALID_KEY); private static final Map<String, String> VALID_KEYS = Collections
.singletonMap("valid-key", VALID_KEY);
@Before @Before
public void setup() throws Exception { public void setup() throws Exception {
...@@ -100,8 +101,8 @@ public class TokenValidatorTests { ...@@ -100,8 +101,8 @@ public class TokenValidatorTests {
given(this.securityService.fetchTokenKeys()).willReturn(INVALID_KEYS); given(this.securityService.fetchTokenKeys()).willReturn(INVALID_KEYS);
String header = "{\"alg\": \"RS256\", \"kid\": \"valid-key\",\"typ\": \"JWT\"}"; String header = "{\"alg\": \"RS256\", \"kid\": \"valid-key\",\"typ\": \"JWT\"}";
String claims = "{\"exp\": 2147483647, \"iss\": \"http://localhost:8080/uaa/oauth/token\", \"scope\": [\"actuator.read\"]}"; String claims = "{\"exp\": 2147483647, \"iss\": \"http://localhost:8080/uaa/oauth/token\", \"scope\": [\"actuator.read\"]}";
this.thrown.expect( this.thrown
AuthorizationExceptionMatcher.withReason(Reason.INVALID_KEY_ID)); .expect(AuthorizationExceptionMatcher.withReason(Reason.INVALID_KEY_ID));
this.tokenValidator.validate( this.tokenValidator.validate(
new Token(getSignedToken(header.getBytes(), claims.getBytes()))); new Token(getSignedToken(header.getBytes(), claims.getBytes())));
} }
...@@ -131,8 +132,7 @@ public class TokenValidatorTests { ...@@ -131,8 +132,7 @@ public class TokenValidatorTests {
} }
@Test @Test
public void validateTokenWhenValidShouldNotFetchTokenKeys() public void validateTokenWhenValidShouldNotFetchTokenKeys() throws Exception {
throws Exception {
ReflectionTestUtils.setField(this.tokenValidator, "tokenKeys", VALID_KEYS); ReflectionTestUtils.setField(this.tokenValidator, "tokenKeys", VALID_KEYS);
given(this.securityService.getUaaUrl()).willReturn("http://localhost:8080/uaa"); given(this.securityService.getUaaUrl()).willReturn("http://localhost:8080/uaa");
String header = "{ \"alg\": \"RS256\", \"kid\": \"valid-key\",\"typ\": \"JWT\"}"; String header = "{ \"alg\": \"RS256\", \"kid\": \"valid-key\",\"typ\": \"JWT\"}";
...@@ -144,7 +144,8 @@ public class TokenValidatorTests { ...@@ -144,7 +144,8 @@ public class TokenValidatorTests {
@Test @Test
public void validateTokenWhenSignatureInvalidShouldThrowException() throws Exception { public void validateTokenWhenSignatureInvalidShouldThrowException() throws Exception {
ReflectionTestUtils.setField(this.tokenValidator, "tokenKeys", Collections.singletonMap("valid-key", INVALID_KEY)); ReflectionTestUtils.setField(this.tokenValidator, "tokenKeys",
Collections.singletonMap("valid-key", INVALID_KEY));
given(this.securityService.getUaaUrl()).willReturn("http://localhost:8080/uaa"); given(this.securityService.getUaaUrl()).willReturn("http://localhost:8080/uaa");
String header = "{ \"alg\": \"RS256\", \"kid\": \"valid-key\",\"typ\": \"JWT\"}"; String header = "{ \"alg\": \"RS256\", \"kid\": \"valid-key\",\"typ\": \"JWT\"}";
String claims = "{ \"exp\": 2147483647, \"iss\": \"http://localhost:8080/uaa/oauth/token\", \"scope\": [\"actuator.read\"]}"; String claims = "{ \"exp\": 2147483647, \"iss\": \"http://localhost:8080/uaa/oauth/token\", \"scope\": [\"actuator.read\"]}";
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
...@@ -109,33 +109,39 @@ public class EmbeddedLdapAutoConfiguration { ...@@ -109,33 +109,39 @@ public class EmbeddedLdapAutoConfiguration {
this.embeddedProperties.getCredential().getUsername(), this.embeddedProperties.getCredential().getUsername(),
this.embeddedProperties.getCredential().getPassword()); this.embeddedProperties.getCredential().getPassword());
} }
setSchema(config);
InMemoryListenerConfig listenerConfig = InMemoryListenerConfig
.createLDAPConfig("LDAP", this.embeddedProperties.getPort());
config.setListenerConfigs(listenerConfig);
this.server = new InMemoryDirectoryServer(config);
importLdif();
this.server.startListening();
setPortProperty(this.applicationContext, this.server.getListenPort());
return this.server;
}
private void setSchema(InMemoryDirectoryServerConfig config) {
if (!this.embeddedProperties.getValidation().isEnabled()) { if (!this.embeddedProperties.getValidation().isEnabled()) {
config.setSchema(null); config.setSchema(null);
return;
} }
else {
Resource schema = this.embeddedProperties.getValidation().getSchema(); Resource schema = this.embeddedProperties.getValidation().getSchema();
if (schema != null) { if (schema != null) {
setSchema(config, schema);
}
}
private void setSchema(InMemoryDirectoryServerConfig config, Resource resource) {
try { try {
config.setSchema(Schema.mergeSchemas(Schema.getDefaultStandardSchema(), Schema defaultSchema = Schema.getDefaultStandardSchema();
Schema.getSchema(schema.getInputStream()))); Schema schema = Schema.getSchema(resource.getInputStream());
config.setSchema(Schema.mergeSchemas(defaultSchema, schema));
} }
catch (Exception ex) { catch (Exception ex) {
throw new IllegalStateException( throw new IllegalStateException(
"Unable to load schema " + schema.getDescription(), ex); "Unable to load schema " + resource.getDescription(), ex);
} }
} }
}
InMemoryListenerConfig listenerConfig = InMemoryListenerConfig
.createLDAPConfig("LDAP", this.embeddedProperties.getPort());
config.setListenerConfigs(listenerConfig);
this.server = new InMemoryDirectoryServer(config);
importLdif();
this.server.startListening();
setPortProperty(this.applicationContext, this.server.getListenPort());
return this.server;
}
private boolean hasCredentials(Credential credential) { private boolean hasCredentials(Credential credential) {
return StringUtils.hasText(credential.getUsername()) return StringUtils.hasText(credential.getUsername())
......
...@@ -203,31 +203,36 @@ public class ResourceServerProperties implements Validator, BeanFactoryAware { ...@@ -203,31 +203,36 @@ public class ResourceServerProperties implements Validator, BeanFactoryAware {
return; return;
} }
ResourceServerProperties resource = (ResourceServerProperties) target; ResourceServerProperties resource = (ResourceServerProperties) target;
validate(resource, errors);
}
private void validate(ResourceServerProperties target, Errors errors) {
if ((StringUtils.hasText(this.jwt.getKeyUri()) if ((StringUtils.hasText(this.jwt.getKeyUri())
|| StringUtils.hasText(this.jwt.getKeyValue())) || StringUtils.hasText(this.jwt.getKeyValue()))
&& StringUtils.hasText(this.jwk.getKeySetUri())) { && StringUtils.hasText(this.jwk.getKeySetUri())) {
errors.reject("ambiguous.keyUri", "Only one of jwt.keyUri (or jwt.keyValue) and jwk.keySetUri should be configured."); errors.reject("ambiguous.keyUri",
"Only one of jwt.keyUri (or jwt.keyValue) and "
+ "jwk.keySetUri should be configured.");
} }
else { else {
if (StringUtils.hasText(this.clientId)) { if (StringUtils.hasText(this.clientId)) {
if (!StringUtils.hasText(this.clientSecret)) { if (!StringUtils.hasText(this.clientSecret)) {
if (!StringUtils.hasText(resource.getUserInfoUri())) { if (!StringUtils.hasText(target.getUserInfoUri())) {
errors.rejectValue("userInfoUri", "missing.userInfoUri", errors.rejectValue("userInfoUri", "missing.userInfoUri",
"Missing userInfoUri (no client secret available)"); "Missing userInfoUri (no client secret available)");
} }
} }
else { else {
if (isPreferTokenInfo() if (isPreferTokenInfo()
&& !StringUtils.hasText(resource.getTokenInfoUri())) { && !StringUtils.hasText(target.getTokenInfoUri())) {
if (StringUtils.hasText(getJwt().getKeyUri()) if (StringUtils.hasText(getJwt().getKeyUri())
|| StringUtils.hasText(getJwt().getKeyValue()) || StringUtils.hasText(getJwt().getKeyValue())
|| StringUtils.hasText(getJwk().getKeySetUri())) { || StringUtils.hasText(getJwk().getKeySetUri())) {
// It's a JWT decoder // It's a JWT decoder
return; return;
} }
if (!StringUtils.hasText(resource.getUserInfoUri())) { if (!StringUtils.hasText(target.getUserInfoUri())) {
errors.rejectValue("tokenInfoUri", "missing.tokenInfoUri", errors.rejectValue("tokenInfoUri", "missing.tokenInfoUri",
"Missing tokenInfoUri and userInfoUri and there is no " "Missing tokenInfoUri and userInfoUri and there is no "
+ "JWT verifier key"); + "JWT verifier key");
...@@ -236,7 +241,6 @@ public class ResourceServerProperties implements Validator, BeanFactoryAware { ...@@ -236,7 +241,6 @@ public class ResourceServerProperties implements Validator, BeanFactoryAware {
} }
} }
} }
} }
private int countBeans(Class<?> type) { private int countBeans(Class<?> type) {
...@@ -294,9 +298,8 @@ public class ResourceServerProperties implements Validator, BeanFactoryAware { ...@@ -294,9 +298,8 @@ public class ResourceServerProperties implements Validator, BeanFactoryAware {
public class Jwk { public class Jwk {
/** /**
* The URI to get verification keys to verify the JWT token. * The URI to get verification keys to verify the JWT token. This can be set when
* This can be set when the authorization server returns a * the authorization server returns a set of verification keys.
* set of verification keys.
*/ */
private String keySetUri; private String keySetUri;
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
...@@ -46,11 +46,9 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplicat ...@@ -46,11 +46,9 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplicat
import org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration; import org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration;
import org.springframework.boot.autoconfigure.web.ResourceProperties.Strategy; import org.springframework.boot.autoconfigure.web.ResourceProperties.Strategy;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.validation.MessageInterpolatorFactory;
import org.springframework.boot.web.filter.OrderedHiddenHttpMethodFilter; import org.springframework.boot.web.filter.OrderedHiddenHttpMethodFilter;
import org.springframework.boot.web.filter.OrderedHttpPutFormContentFilter; import org.springframework.boot.web.filter.OrderedHttpPutFormContentFilter;
import org.springframework.boot.web.filter.OrderedRequestContextFilter; import org.springframework.boot.web.filter.OrderedRequestContextFilter;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
...@@ -70,8 +68,6 @@ import org.springframework.util.StringUtils; ...@@ -70,8 +68,6 @@ import org.springframework.util.StringUtils;
import org.springframework.validation.DefaultMessageCodesResolver; import org.springframework.validation.DefaultMessageCodesResolver;
import org.springframework.validation.MessageCodesResolver; import org.springframework.validation.MessageCodesResolver;
import org.springframework.validation.Validator; import org.springframework.validation.Validator;
import org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean;
import org.springframework.validation.beanvalidation.SpringValidatorAdapter;
import org.springframework.web.accept.ContentNegotiationManager; import org.springframework.web.accept.ContentNegotiationManager;
import org.springframework.web.bind.support.ConfigurableWebBindingInitializer; import org.springframework.web.bind.support.ConfigurableWebBindingInitializer;
import org.springframework.web.context.request.RequestContextListener; import org.springframework.web.context.request.RequestContextListener;
...@@ -134,8 +130,6 @@ public class WebMvcAutoConfiguration { ...@@ -134,8 +130,6 @@ public class WebMvcAutoConfiguration {
public static String DEFAULT_SUFFIX = ""; public static String DEFAULT_SUFFIX = "";
private static final String JSR303_VALIDATOR_CLASS = "javax.validation.Validator";
@Bean @Bean
@ConditionalOnMissingBean(HiddenHttpMethodFilter.class) @ConditionalOnMissingBean(HiddenHttpMethodFilter.class)
public OrderedHiddenHttpMethodFilter hiddenHttpMethodFilter() { public OrderedHiddenHttpMethodFilter hiddenHttpMethodFilter() {
...@@ -406,17 +400,12 @@ public class WebMvcAutoConfiguration { ...@@ -406,17 +400,12 @@ public class WebMvcAutoConfiguration {
@Bean @Bean
@Override @Override
public Validator mvcValidator() { public Validator mvcValidator() {
if (isJsr303Present()) { if (!ClassUtils.isPresent("javax.validation.Validator",
Validator userDefinedValidator = getValidator(); getClass().getClassLoader())) {
return new Jsr303ValidatorHandler(getApplicationContext(),
userDefinedValidator).wrapJsr303Validator();
}
return super.mvcValidator(); return super.mvcValidator();
} }
return WebMvcValidator.get(getApplicationContext(),
private boolean isJsr303Present() { getValidator());
return ClassUtils.isPresent(JSR303_VALIDATOR_CLASS,
getApplicationContext().getClassLoader());
} }
@Override @Override
...@@ -560,60 +549,4 @@ public class WebMvcAutoConfiguration { ...@@ -560,60 +549,4 @@ public class WebMvcAutoConfiguration {
} }
static class Jsr303ValidatorHandler {
private final ApplicationContext applicationContext;
private final Validator userDefinedValidator;
Jsr303ValidatorHandler(ApplicationContext applicationContext,
Validator userDefinedValidator) {
this.applicationContext = applicationContext;
this.userDefinedValidator = userDefinedValidator;
}
public Validator wrapJsr303Validator() {
try {
if (this.userDefinedValidator != null) {
if (this.userDefinedValidator instanceof javax.validation.Validator) {
return wrap((javax.validation.Validator) this.userDefinedValidator, false);
}
else {
return this.userDefinedValidator;
}
}
else {
return wrap(this.applicationContext.getBean(
javax.validation.Validator.class), true);
}
}
catch (NoSuchBeanDefinitionException ex) {
OptionalValidatorFactoryBean factory = new OptionalValidatorFactoryBean();
MessageInterpolatorFactory interpolatorFactory = new MessageInterpolatorFactory();
factory.setMessageInterpolator(interpolatorFactory.getObject());
return new SpringValidatorAdapterWrapper(factory, false);
}
}
/**
* Wrap the specified {@code validator}.
* @param validator the validator to wrap
* @param bean {@code true} if the specified {@code validator} is a bean managed
* in the context
* @return a {@link Validator} wrapping the specified argument
*/
private Validator wrap(javax.validation.Validator validator, boolean bean) {
if (validator instanceof SpringValidatorAdapter) {
return new SpringValidatorAdapterWrapper(
(SpringValidatorAdapter) validator, bean);
}
else {
return new SpringValidatorAdapterWrapper(
new SpringValidatorAdapter(validator), false);
}
}
}
} }
...@@ -19,31 +19,38 @@ package org.springframework.boot.autoconfigure.web; ...@@ -19,31 +19,38 @@ package org.springframework.boot.autoconfigure.web;
import org.springframework.beans.BeansException; import org.springframework.beans.BeansException;
import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.boot.validation.MessageInterpolatorFactory;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware; import org.springframework.context.ApplicationContextAware;
import org.springframework.validation.Errors; import org.springframework.validation.Errors;
import org.springframework.validation.SmartValidator;
import org.springframework.validation.Validator; import org.springframework.validation.Validator;
import org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean;
import org.springframework.validation.beanvalidation.SpringValidatorAdapter; import org.springframework.validation.beanvalidation.SpringValidatorAdapter;
/** /**
* Wraps a {@link SpringValidatorAdapter} so that only the Spring's {@link Validator} * A {@link SmartValidator} exposed as a bean for WebMvc use. Wraps existing
* {@link SpringValidatorAdapter} instances so that only the Spring's {@link Validator}
* type is exposed. This prevents such a bean to expose both the Spring and JSR-303 * type is exposed. This prevents such a bean to expose both the Spring and JSR-303
* validator contract at the same time. * validator contract at the same time.
* *
* @author Stephane Nicoll * @author Stephane Nicoll
* @author Phillip Webb
*/ */
class SpringValidatorAdapterWrapper class WebMvcValidator implements SmartValidator, ApplicationContextAware,
implements Validator, ApplicationContextAware, InitializingBean, DisposableBean { InitializingBean, DisposableBean {
private final SpringValidatorAdapter target; private final SpringValidatorAdapter target;
private final boolean managed;
SpringValidatorAdapterWrapper(SpringValidatorAdapter target, boolean managed) { private final boolean existingBean;
WebMvcValidator(SpringValidatorAdapter target, boolean existingBean) {
this.target = target; this.target = target;
this.managed = managed; this.existingBean = existingBean;
} }
public SpringValidatorAdapter getTarget() { SpringValidatorAdapter getTarget() {
return this.target; return this.target;
} }
...@@ -57,27 +64,81 @@ class SpringValidatorAdapterWrapper ...@@ -57,27 +64,81 @@ class SpringValidatorAdapterWrapper
this.target.validate(target, errors); this.target.validate(target, errors);
} }
@Override
public void validate(Object target, Errors errors, Object... validationHints) {
this.target.validate(target, errors, validationHints);
}
@Override @Override
public void setApplicationContext(ApplicationContext applicationContext) public void setApplicationContext(ApplicationContext applicationContext)
throws BeansException { throws BeansException {
if (!this.managed && this.target instanceof ApplicationContextAware) { if (!this.existingBean && this.target instanceof ApplicationContextAware) {
((ApplicationContextAware) this.target).setApplicationContext( ((ApplicationContextAware) this.target)
applicationContext); .setApplicationContext(applicationContext);
} }
} }
@Override @Override
public void afterPropertiesSet() throws Exception { public void afterPropertiesSet() throws Exception {
if (!this.managed && this.target instanceof InitializingBean) { if (!this.existingBean && this.target instanceof InitializingBean) {
((InitializingBean) this.target).afterPropertiesSet(); ((InitializingBean) this.target).afterPropertiesSet();
} }
} }
@Override @Override
public void destroy() throws Exception { public void destroy() throws Exception {
if (!this.managed && this.target instanceof DisposableBean) { if (!this.existingBean && this.target instanceof DisposableBean) {
((DisposableBean) this.target).destroy(); ((DisposableBean) this.target).destroy();
} }
} }
public static Validator get(ApplicationContext applicationContext,
Validator validator) {
if (validator != null) {
return wrap(validator, false);
}
return getExistingOrCreate(applicationContext);
}
private static Validator getExistingOrCreate(ApplicationContext applicationContext) {
Validator existing = getExisting(applicationContext);
if (existing != null) {
return wrap(existing, true);
}
return create();
}
private static Validator getExisting(ApplicationContext applicationContext) {
try {
javax.validation.Validator validator = applicationContext
.getBean(javax.validation.Validator.class);
if (validator instanceof Validator) {
return (Validator) validator;
}
return new SpringValidatorAdapter(validator);
}
catch (NoSuchBeanDefinitionException ex) {
return null;
}
}
private static Validator create() {
OptionalValidatorFactoryBean validator = new OptionalValidatorFactoryBean();
validator.setMessageInterpolator(new MessageInterpolatorFactory().getObject());
return wrap(validator, false);
}
private static Validator wrap(Validator validator, boolean existingBean) {
if (validator instanceof javax.validation.Validator) {
if (validator instanceof SpringValidatorAdapter) {
return new WebMvcValidator((SpringValidatorAdapter) validator,
existingBean);
}
return new WebMvcValidator(
new SpringValidatorAdapter((javax.validation.Validator) validator),
existingBean);
}
return validator;
}
} }
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
...@@ -32,11 +32,11 @@ import static org.assertj.core.api.Assertions.assertThat; ...@@ -32,11 +32,11 @@ import static org.assertj.core.api.Assertions.assertThat;
*/ */
public class GroovyTemplateAvailabilityProviderTests { public class GroovyTemplateAvailabilityProviderTests {
private final TemplateAvailabilityProvider provider = new GroovyTemplateAvailabilityProvider(); private TemplateAvailabilityProvider provider = new GroovyTemplateAvailabilityProvider();
private final ResourceLoader resourceLoader = new DefaultResourceLoader(); private ResourceLoader resourceLoader = new DefaultResourceLoader();
private final MockEnvironment environment = new MockEnvironment(); private MockEnvironment environment = new MockEnvironment();
@Test @Test
public void availabilityOfTemplateInDefaultLocation() { public void availabilityOfTemplateInDefaultLocation() {
......
...@@ -389,11 +389,13 @@ public class OAuth2AutoConfigurationTests { ...@@ -389,11 +389,13 @@ public class OAuth2AutoConfigurationTests {
} }
@Test @Test
public void resourceServerConditionWhenJwkConfigurationPresentShouldMatch() throws Exception { public void resourceServerConditionWhenJwkConfigurationPresentShouldMatch()
throws Exception {
this.context = new AnnotationConfigEmbeddedWebApplicationContext(); this.context = new AnnotationConfigEmbeddedWebApplicationContext();
EnvironmentTestUtils.addEnvironment(this.context, EnvironmentTestUtils.addEnvironment(this.context,
"security.oauth2.resource.jwk.key-set-uri:http://my-auth-server/token_keys"); "security.oauth2.resource.jwk.key-set-uri:http://my-auth-server/token_keys");
this.context.register(ResourceServerConfiguration.class, MinimalSecureWebApplication.class); this.context.register(ResourceServerConfiguration.class,
MinimalSecureWebApplication.class);
this.context.refresh(); this.context.refresh();
assertThat(countBeans(RESOURCE_SERVER_CONFIG)).isEqualTo(1); assertThat(countBeans(RESOURCE_SERVER_CONFIG)).isEqualTo(1);
} }
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -68,13 +68,15 @@ public class ResourceServerPropertiesTests { ...@@ -68,13 +68,15 @@ public class ResourceServerPropertiesTests {
} }
@Test @Test
public void validateWhenBothJwtAndJwtKeyConfigurationPresentShouldFail() throws Exception { public void validateWhenBothJwtAndJwtKeyConfigurationPresentShouldFail()
throws Exception {
this.properties.getJwk().setKeySetUri("http://my-auth-server/token_keys"); this.properties.getJwk().setKeySetUri("http://my-auth-server/token_keys");
this.properties.getJwt().setKeyUri("http://my-auth-server/token_key"); this.properties.getJwt().setKeyUri("http://my-auth-server/token_key");
setListableBeanFactory(); setListableBeanFactory();
Errors errors = mock(Errors.class); Errors errors = mock(Errors.class);
this.properties.validate(this.properties, errors); this.properties.validate(this.properties, errors);
verify(errors).reject("ambiguous.keyUri", "Only one of jwt.keyUri (or jwt.keyValue) and jwk.keySetUri should be configured."); verify(errors).reject("ambiguous.keyUri",
"Only one of jwt.keyUri (or jwt.keyValue) and jwk.keySetUri should be configured.");
} }
...@@ -89,14 +91,19 @@ public class ResourceServerPropertiesTests { ...@@ -89,14 +91,19 @@ public class ResourceServerPropertiesTests {
private void setListableBeanFactory() { private void setListableBeanFactory() {
ListableBeanFactory beanFactory = new StaticWebApplicationContext() { ListableBeanFactory beanFactory = new StaticWebApplicationContext() {
@Override @Override
public String[] getBeanNamesForType(Class<?> type, boolean includeNonSingletons, boolean allowEagerInit) { public String[] getBeanNamesForType(Class<?> type,
if (type.isAssignableFrom(ResourceServerTokenServicesConfiguration.class)) { boolean includeNonSingletons, boolean allowEagerInit) {
return new String[]{"ResourceServerTokenServicesConfiguration"}; if (type.isAssignableFrom(
ResourceServerTokenServicesConfiguration.class)) {
return new String[] { "ResourceServerTokenServicesConfiguration" };
} }
return new String[0]; return new String[0];
} }
}; };
this.properties.setBeanFactory(beanFactory); this.properties.setBeanFactory(beanFactory);
} }
} }
...@@ -17,9 +17,13 @@ ...@@ -17,9 +17,13 @@
package org.springframework.boot.autoconfigure.web; package org.springframework.boot.autoconfigure.web;
import java.io.File; import java.io.File;
import java.net.URL;
import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory;
import org.junit.After; import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before; import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException; import org.junit.rules.ExpectedException;
...@@ -38,6 +42,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties ...@@ -38,6 +42,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.boot.test.util.EnvironmentTestUtils; import org.springframework.boot.test.util.EnvironmentTestUtils;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.test.util.ReflectionTestUtils;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
...@@ -70,6 +75,14 @@ public class DefaultServletContainerCustomizerIntegrationTests { ...@@ -70,6 +75,14 @@ public class DefaultServletContainerCustomizerIntegrationTests {
} }
} }
@BeforeClass
@AfterClass
public static void uninstallUrlStreamHandlerFactory() {
ReflectionTestUtils.setField(TomcatURLStreamHandlerFactory.class, "instance",
null);
ReflectionTestUtils.setField(URL.class, "factory", null);
}
@Test @Test
public void createFromConfigClass() throws Exception { public void createFromConfigClass() throws Exception {
this.context = new AnnotationConfigEmbeddedWebApplicationContext(); this.context = new AnnotationConfigEmbeddedWebApplicationContext();
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -17,10 +17,14 @@ ...@@ -17,10 +17,14 @@
package org.springframework.boot.autoconfigure.web; package org.springframework.boot.autoconfigure.web;
import java.net.URI; import java.net.URI;
import java.net.URL;
import javax.servlet.MultipartConfigElement; import javax.servlet.MultipartConfigElement;
import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory;
import org.junit.After; import org.junit.After;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException; import org.junit.rules.ExpectedException;
...@@ -76,6 +80,14 @@ public class MultipartAutoConfigurationTests { ...@@ -76,6 +80,14 @@ public class MultipartAutoConfigurationTests {
} }
} }
@BeforeClass
@AfterClass
public static void uninstallUrlStreamHandlerFactory() {
ReflectionTestUtils.setField(TomcatURLStreamHandlerFactory.class, "instance",
null);
ReflectionTestUtils.setField(URL.class, "factory", null);
}
@Test @Test
public void containerWithNothing() throws Exception { public void containerWithNothing() throws Exception {
this.context = new AnnotationConfigEmbeddedWebApplicationContext( this.context = new AnnotationConfigEmbeddedWebApplicationContext(
......
...@@ -662,8 +662,8 @@ public class WebMvcAutoConfigurationTests { ...@@ -662,8 +662,8 @@ public class WebMvcAutoConfigurationTests {
.isEmpty(); .isEmpty();
assertThat(this.context.getBeansOfType(Validator.class)).hasSize(1); assertThat(this.context.getBeansOfType(Validator.class)).hasSize(1);
Validator validator = this.context.getBean(Validator.class); Validator validator = this.context.getBean(Validator.class);
assertThat(validator).isSameAs(this.context.getBean(MvcValidator.class) assertThat(validator)
.validator); .isSameAs(this.context.getBean(MvcValidator.class).validator);
} }
@Test @Test
...@@ -674,8 +674,8 @@ public class WebMvcAutoConfigurationTests { ...@@ -674,8 +674,8 @@ public class WebMvcAutoConfigurationTests {
.isEmpty(); .isEmpty();
assertThat(this.context.getBeansOfType(Validator.class)).hasSize(1); assertThat(this.context.getBeansOfType(Validator.class)).hasSize(1);
Validator validator = this.context.getBean(Validator.class); Validator validator = this.context.getBean(Validator.class);
assertThat(validator).isInstanceOf(SpringValidatorAdapterWrapper.class); assertThat(validator).isInstanceOf(WebMvcValidator.class);
assertThat(((SpringValidatorAdapterWrapper) validator).getTarget()) assertThat(((WebMvcValidator) validator).getTarget())
.isSameAs(this.context.getBean(MvcJsr303Validator.class).validator); .isSameAs(this.context.getBean(MvcJsr303Validator.class).validator);
} }
...@@ -687,8 +687,8 @@ public class WebMvcAutoConfigurationTests { ...@@ -687,8 +687,8 @@ public class WebMvcAutoConfigurationTests {
.hasSize(1); .hasSize(1);
assertThat(this.context.getBeansOfType(Validator.class)).hasSize(2); assertThat(this.context.getBeansOfType(Validator.class)).hasSize(2);
Validator validator = this.context.getBean("mvcValidator", Validator.class); Validator validator = this.context.getBean("mvcValidator", Validator.class);
assertThat(validator).isInstanceOf(SpringValidatorAdapterWrapper.class); assertThat(validator).isInstanceOf(WebMvcValidator.class);
assertThat(((SpringValidatorAdapterWrapper) validator).getTarget()) assertThat(((WebMvcValidator) validator).getTarget())
.isSameAs(this.context.getBean(javax.validation.Validator.class)); .isSameAs(this.context.getBean(javax.validation.Validator.class));
} }
...@@ -700,8 +700,8 @@ public class WebMvcAutoConfigurationTests { ...@@ -700,8 +700,8 @@ public class WebMvcAutoConfigurationTests {
.hasSize(1); .hasSize(1);
assertThat(this.context.getBeansOfType(Validator.class)).hasSize(1); assertThat(this.context.getBeansOfType(Validator.class)).hasSize(1);
Validator validator = this.context.getBean(Validator.class); Validator validator = this.context.getBean(Validator.class);
assertThat(validator).isInstanceOf(SpringValidatorAdapterWrapper.class); assertThat(validator).isInstanceOf(WebMvcValidator.class);
SpringValidatorAdapter target = ((SpringValidatorAdapterWrapper) validator) SpringValidatorAdapter target = ((WebMvcValidator) validator)
.getTarget(); .getTarget();
assertThat(new DirectFieldAccessor(target).getPropertyValue("targetValidator")) assertThat(new DirectFieldAccessor(target).getPropertyValue("targetValidator"))
.isSameAs(this.context.getBean(javax.validation.Validator.class)); .isSameAs(this.context.getBean(javax.validation.Validator.class));
......
...@@ -37,11 +37,11 @@ import static org.mockito.Mockito.times; ...@@ -37,11 +37,11 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
/** /**
* Tests for {@link SpringValidatorAdapterWrapper}. * Tests for {@link WebMvcValidator}.
* *
* @author Stephane Nicoll * @author Stephane Nicoll
*/ */
public class SpringValidatorAdapterWrapperTests { public class WebMvcValidatorTests {
private AnnotationConfigApplicationContext context; private AnnotationConfigApplicationContext context;
...@@ -54,11 +54,11 @@ public class SpringValidatorAdapterWrapperTests { ...@@ -54,11 +54,11 @@ public class SpringValidatorAdapterWrapperTests {
@Test @Test
public void wrapLocalValidatorFactoryBean() { public void wrapLocalValidatorFactoryBean() {
SpringValidatorAdapterWrapper wrapper = load( WebMvcValidator wrapper = load(
LocalValidatorFactoryBeanConfig.class); LocalValidatorFactoryBeanConfig.class);
assertThat(wrapper.supports(SampleData.class)).isTrue(); assertThat(wrapper.supports(SampleData.class)).isTrue();
MapBindingResult errors = new MapBindingResult( MapBindingResult errors = new MapBindingResult(new HashMap<String, Object>(),
new HashMap<String, Object>(), "test"); "test");
wrapper.validate(new SampleData(40), errors); wrapper.validate(new SampleData(40), errors);
assertThat(errors.getErrorCount()).isEqualTo(1); assertThat(errors.getErrorCount()).isEqualTo(1);
} }
...@@ -66,8 +66,8 @@ public class SpringValidatorAdapterWrapperTests { ...@@ -66,8 +66,8 @@ public class SpringValidatorAdapterWrapperTests {
@Test @Test
public void wrapperInvokesCallbackOnNonManagedBean() { public void wrapperInvokesCallbackOnNonManagedBean() {
load(NonManagedBeanConfig.class); load(NonManagedBeanConfig.class);
LocalValidatorFactoryBean validator = this.context.getBean( LocalValidatorFactoryBean validator = this.context
NonManagedBeanConfig.class).validator; .getBean(NonManagedBeanConfig.class).validator;
verify(validator, times(1)).setApplicationContext(any(ApplicationContext.class)); verify(validator, times(1)).setApplicationContext(any(ApplicationContext.class));
verify(validator, times(1)).afterPropertiesSet(); verify(validator, times(1)).afterPropertiesSet();
verify(validator, times(0)).destroy(); verify(validator, times(0)).destroy();
...@@ -79,8 +79,8 @@ public class SpringValidatorAdapterWrapperTests { ...@@ -79,8 +79,8 @@ public class SpringValidatorAdapterWrapperTests {
@Test @Test
public void wrapperDoesNotInvokeCallbackOnManagedBean() { public void wrapperDoesNotInvokeCallbackOnManagedBean() {
load(ManagedBeanConfig.class); load(ManagedBeanConfig.class);
LocalValidatorFactoryBean validator = this.context.getBean( LocalValidatorFactoryBean validator = this.context
ManagedBeanConfig.class).validator; .getBean(ManagedBeanConfig.class).validator;
verify(validator, times(0)).setApplicationContext(any(ApplicationContext.class)); verify(validator, times(0)).setApplicationContext(any(ApplicationContext.class));
verify(validator, times(0)).afterPropertiesSet(); verify(validator, times(0)).afterPropertiesSet();
verify(validator, times(0)).destroy(); verify(validator, times(0)).destroy();
...@@ -89,12 +89,12 @@ public class SpringValidatorAdapterWrapperTests { ...@@ -89,12 +89,12 @@ public class SpringValidatorAdapterWrapperTests {
verify(validator, times(0)).destroy(); verify(validator, times(0)).destroy();
} }
private SpringValidatorAdapterWrapper load(Class<?> config) { private WebMvcValidator load(Class<?> config) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(config); ctx.register(config);
ctx.refresh(); ctx.refresh();
this.context = ctx; this.context = ctx;
return this.context.getBean(SpringValidatorAdapterWrapper.class); return this.context.getBean(WebMvcValidator.class);
} }
@Configuration @Configuration
...@@ -106,8 +106,8 @@ public class SpringValidatorAdapterWrapperTests { ...@@ -106,8 +106,8 @@ public class SpringValidatorAdapterWrapperTests {
} }
@Bean @Bean
public SpringValidatorAdapterWrapper wrapper() { public WebMvcValidator wrapper() {
return new SpringValidatorAdapterWrapper(validator(), true); return new WebMvcValidator(validator(), true);
} }
} }
...@@ -115,12 +115,12 @@ public class SpringValidatorAdapterWrapperTests { ...@@ -115,12 +115,12 @@ public class SpringValidatorAdapterWrapperTests {
@Configuration @Configuration
static class NonManagedBeanConfig { static class NonManagedBeanConfig {
private final LocalValidatorFactoryBean validator private final LocalValidatorFactoryBean validator = mock(
= mock(LocalValidatorFactoryBean.class); LocalValidatorFactoryBean.class);
@Bean @Bean
public SpringValidatorAdapterWrapper wrapper() { public WebMvcValidator wrapper() {
return new SpringValidatorAdapterWrapper(this.validator, false); return new WebMvcValidator(this.validator, false);
} }
} }
...@@ -128,12 +128,12 @@ public class SpringValidatorAdapterWrapperTests { ...@@ -128,12 +128,12 @@ public class SpringValidatorAdapterWrapperTests {
@Configuration @Configuration
static class ManagedBeanConfig { static class ManagedBeanConfig {
private final LocalValidatorFactoryBean validator private final LocalValidatorFactoryBean validator = mock(
= mock(LocalValidatorFactoryBean.class); LocalValidatorFactoryBean.class);
@Bean @Bean
public SpringValidatorAdapterWrapper wrapper() { public WebMvcValidator wrapper() {
return new SpringValidatorAdapterWrapper(this.validator, true); return new WebMvcValidator(this.validator, true);
} }
} }
......
...@@ -16,10 +16,15 @@ ...@@ -16,10 +16,15 @@
package org.springframework.boot.autoconfigure.websocket; package org.springframework.boot.autoconfigure.websocket;
import java.net.URL;
import javax.websocket.server.ServerContainer; import javax.websocket.server.ServerContainer;
import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory;
import org.junit.After; import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before; import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext; import org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext;
...@@ -29,6 +34,7 @@ import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletConta ...@@ -29,6 +34,7 @@ import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletConta
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.test.util.ReflectionTestUtils;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
...@@ -53,6 +59,14 @@ public class WebSocketAutoConfigurationTests { ...@@ -53,6 +59,14 @@ public class WebSocketAutoConfigurationTests {
} }
} }
@BeforeClass
@AfterClass
public static void uninstallUrlStreamHandlerFactory() {
ReflectionTestUtils.setField(TomcatURLStreamHandlerFactory.class, "instance",
null);
ReflectionTestUtils.setField(URL.class, "factory", null);
}
@Test @Test
public void tomcatServerContainerIsAvailableFromTheServletContext() { public void tomcatServerContainerIsAvailableFromTheServletContext() {
serverContainerIsAvailableFromTheServletContext(TomcatConfiguration.class, serverContainerIsAvailableFromTheServletContext(TomcatConfiguration.class,
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2015 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2015 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2015 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
...@@ -2048,7 +2048,7 @@ your application defines, if any. ...@@ -2048,7 +2048,7 @@ your application defines, if any.
NOTE: By default, batch applications require a `DataSource` to store job details. If you NOTE: By default, batch applications require a `DataSource` to store job details. If you
want to deviate from that, you'll need to implement `BatchConfigurer`, see want to deviate from that, you'll need to implement `BatchConfigurer`, see
{spring-batch-javadoc}/core/configuration/annotation/EnableBatchProcessing.html[The {spring-batch-javadoc}/core/configuration/annotation/EnableBatchProcessing.html[The
Javadoc of @EnableBatchProcessing] for more details. Javadoc of `@EnableBatchProcessing`] for more details.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<!-- Your own application should inherit from spring-boot-starter-parent --> <!-- Your own application should inherit from spring-boot-starter-parent -->
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -120,7 +120,8 @@ class MockDefinition extends Definition { ...@@ -120,7 +120,8 @@ class MockDefinition extends Definition {
MockDefinition other = (MockDefinition) obj; MockDefinition other = (MockDefinition) obj;
boolean result = super.equals(obj); boolean result = super.equals(obj);
result = result && ObjectUtils.nullSafeEquals(this.typeToMock, other.typeToMock); result = result && ObjectUtils.nullSafeEquals(this.typeToMock, other.typeToMock);
result = result && ObjectUtils.nullSafeEquals(this.extraInterfaces, other.extraInterfaces); result = result && ObjectUtils.nullSafeEquals(this.extraInterfaces,
other.extraInterfaces);
result = result && ObjectUtils.nullSafeEquals(this.answer, other.answer); result = result && ObjectUtils.nullSafeEquals(this.answer, other.answer);
result = result && this.serializable == other.serializable; result = result && this.serializable == other.serializable;
return result; return result;
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2015 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2015 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2015 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
...@@ -278,12 +278,19 @@ class ProjectLibraries implements Libraries { ...@@ -278,12 +278,19 @@ class ProjectLibraries implements Libraries {
} }
/**
* Strategy used to resolve configurations regardless of the underlying Gradle
* version.
*/
private interface TargetConfigurationResolver { private interface TargetConfigurationResolver {
Configuration resolveTargetConfiguration(ProjectDependency projectDependency); Configuration resolveTargetConfiguration(ProjectDependency projectDependency);
} }
/**
* {@link TargetConfigurationResolver} for Gradle 2.x.
*/
private static final class Gradle2TargetConfigurationResolver private static final class Gradle2TargetConfigurationResolver
implements TargetConfigurationResolver { implements TargetConfigurationResolver {
...@@ -295,6 +302,9 @@ class ProjectLibraries implements Libraries { ...@@ -295,6 +302,9 @@ class ProjectLibraries implements Libraries {
} }
/**
* {@link TargetConfigurationResolver} for Gradle 3.x.
*/
private static final class Gradle3TargetConfigurationResolver private static final class Gradle3TargetConfigurationResolver
implements TargetConfigurationResolver { implements TargetConfigurationResolver {
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment