Merge branch '2.0.x'
This commit is contained in:
@@ -406,9 +406,7 @@ public class ConfigurationPropertiesReportEndpoint implements ApplicationContext
|
||||
&& Character.isUpperCase(propertyName.charAt(1))) {
|
||||
return propertyName;
|
||||
}
|
||||
else {
|
||||
return StringUtils.capitalize(propertyName);
|
||||
}
|
||||
return StringUtils.capitalize(propertyName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ import org.springframework.core.env.Environment;
|
||||
* default the properties must be present in the {@link Environment} and
|
||||
* <strong>not</strong> equal to {@code false}. The {@link #havingValue()} and
|
||||
* {@link #matchIfMissing()} attributes allow further customizations.
|
||||
*
|
||||
* <p>
|
||||
* The {@link #havingValue} attribute can be used to specify the value that the property
|
||||
* should have. The table below shows when a condition matches according to the property
|
||||
@@ -67,12 +66,10 @@ import org.springframework.core.env.Environment;
|
||||
* <td>yes</td>
|
||||
* </tr>
|
||||
* </table>
|
||||
*
|
||||
* <p>
|
||||
* If the property is not contained in the {@link Environment} at all, the
|
||||
* {@link #matchIfMissing()} attribute is consulted. By default missing attributes do not
|
||||
* match.
|
||||
*
|
||||
* <p>
|
||||
* This condition cannot be reliably used for matching collection properties. For example,
|
||||
* in the following configuration, the condition matches if {@code spring.example.values}
|
||||
|
||||
@@ -36,7 +36,7 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
|
||||
*/
|
||||
public class OnPropertyListCondition extends SpringBootCondition {
|
||||
|
||||
private static final Bindable<List<String>> SIMPLE_LIST = Bindable
|
||||
private static final Bindable<List<String>> STRING_LIST = Bindable
|
||||
.listOf(String.class);
|
||||
|
||||
private final String propertyName;
|
||||
@@ -59,7 +59,7 @@ public class OnPropertyListCondition extends SpringBootCondition {
|
||||
public ConditionOutcome getMatchOutcome(ConditionContext context,
|
||||
AnnotatedTypeMetadata metadata) {
|
||||
BindResult<?> property = Binder.get(context.getEnvironment())
|
||||
.bind(this.propertyName, SIMPLE_LIST);
|
||||
.bind(this.propertyName, STRING_LIST);
|
||||
ConditionMessage.Builder messageBuilder = this.messageBuilder.get();
|
||||
if (property.isBound()) {
|
||||
return ConditionOutcome
|
||||
|
||||
@@ -65,10 +65,8 @@ class OnWebApplicationCondition extends SpringBootCondition {
|
||||
switch (deduceType(metadata)) {
|
||||
case SERVLET:
|
||||
return isServletWebApplication(context);
|
||||
|
||||
case REACTIVE:
|
||||
return isReactiveWebApplication(context);
|
||||
|
||||
default:
|
||||
return isAnyWebApplication(context, required);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.springframework.web.servlet.handler.HandlerMappingIntrospector;
|
||||
* used for Spring MVC applications.
|
||||
*
|
||||
* @author Madhura Bhave
|
||||
* @since 2.0.5
|
||||
*/
|
||||
public class MvcRequestMatcherProvider implements RequestMatcherProvider {
|
||||
|
||||
|
||||
@@ -27,6 +27,11 @@ import org.springframework.security.web.util.matcher.RequestMatcher;
|
||||
@FunctionalInterface
|
||||
public interface RequestMatcherProvider {
|
||||
|
||||
/**
|
||||
* Return the {@link RequestMatcher} to be used for the specified pattern.
|
||||
* @param pattern the request pattern
|
||||
* @return a request matcher
|
||||
*/
|
||||
RequestMatcher getRequestMatcher(String pattern);
|
||||
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -149,6 +149,11 @@ final class JavaPluginAction implements PluginApplicationAction {
|
||||
compile.doFirst(new AdditionalMetadataLocationsConfigurer());
|
||||
}
|
||||
|
||||
/**
|
||||
* Task {@link Action} to add additional meta-data locations. We need to use an
|
||||
* inner-class rather than a lambda due to
|
||||
* https://github.com/gradle/gradle/issues/5510.
|
||||
*/
|
||||
private static class AdditionalMetadataLocationsConfigurer implements Action<Task> {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -42,7 +42,7 @@ final class EnvironmentConverter {
|
||||
private static final Set<String> SERVLET_ENVIRONMENT_SOURCE_NAMES;
|
||||
|
||||
static {
|
||||
final Set<String> names = new HashSet<>();
|
||||
Set<String> names = new HashSet<>();
|
||||
names.add(StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME);
|
||||
names.add(StandardServletEnvironment.SERVLET_CONFIG_PROPERTY_SOURCE_NAME);
|
||||
names.add(StandardServletEnvironment.JNDI_PROPERTY_SOURCE_NAME);
|
||||
@@ -65,20 +65,20 @@ final class EnvironmentConverter {
|
||||
* type. If the environment is already of the same type, no conversion is performed
|
||||
* and it is returned unchanged.
|
||||
* @param environment the Environment to convert
|
||||
* @param conversionType the type to convert the Environment to
|
||||
* @param type the type to convert the Environment to
|
||||
* @return the converted Environment
|
||||
*/
|
||||
StandardEnvironment convertEnvironmentIfNecessary(ConfigurableEnvironment environment,
|
||||
Class<? extends StandardEnvironment> conversionType) {
|
||||
if (conversionType.equals(environment.getClass())) {
|
||||
Class<? extends StandardEnvironment> type) {
|
||||
if (type.equals(environment.getClass())) {
|
||||
return (StandardEnvironment) environment;
|
||||
}
|
||||
return convertEnvironment(environment, conversionType);
|
||||
return convertEnvironment(environment, type);
|
||||
}
|
||||
|
||||
private StandardEnvironment convertEnvironment(ConfigurableEnvironment environment,
|
||||
Class<? extends StandardEnvironment> conversionType) {
|
||||
StandardEnvironment result = createEnvironment(conversionType);
|
||||
Class<? extends StandardEnvironment> type) {
|
||||
StandardEnvironment result = createEnvironment(type);
|
||||
result.setActiveProfiles(environment.getActiveProfiles());
|
||||
result.setConversionService(environment.getConversionService());
|
||||
copyPropertySources(environment, result);
|
||||
@@ -86,9 +86,9 @@ final class EnvironmentConverter {
|
||||
}
|
||||
|
||||
private StandardEnvironment createEnvironment(
|
||||
Class<? extends StandardEnvironment> conversionType) {
|
||||
Class<? extends StandardEnvironment> type) {
|
||||
try {
|
||||
return conversionType.newInstance();
|
||||
return type.newInstance();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
return new StandardEnvironment();
|
||||
|
||||
@@ -454,15 +454,12 @@ public class ConfigFileApplicationListener
|
||||
}
|
||||
}
|
||||
}
|
||||
Set<String> processedExtensions = new HashSet<>();
|
||||
Set<String> processed = new HashSet<>();
|
||||
for (PropertySourceLoader loader : this.propertySourceLoaders) {
|
||||
for (String fileExtension : loader.getFileExtensions()) {
|
||||
if (!processedExtensions.contains(fileExtension)) {
|
||||
processedExtensions.add(fileExtension);
|
||||
String prefix = location + name;
|
||||
fileExtension = "." + fileExtension;
|
||||
loadForFileExtension(loader, prefix, fileExtension, profile,
|
||||
filterFactory, consumer);
|
||||
if (processed.add(fileExtension)) {
|
||||
loadForFileExtension(loader, location + name, "." + fileExtension,
|
||||
profile, filterFactory, consumer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user