Merge branch '1.1.x'

Conflicts:
	spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaProperties.java
This commit is contained in:
Phillip Webb 2014-08-18 13:02:44 -07:00
commit 83bd36d8e0
3 changed files with 73 additions and 2 deletions

View File

@ -97,7 +97,7 @@ public class MetricFilterAutoConfiguration {
try {
httpStatus = HttpStatus.valueOf(status);
}
catch (Exception e) {
catch (Exception ex) {
// not convertible
}
if (bestMatchingPattern != null) {

View File

@ -17,7 +17,14 @@
package org.springframework.boot.autoconfigure;
import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.boot.autoconfigure.MessageSourceAutoConfiguration.ResourceBundleCondition;
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
@ -118,7 +125,7 @@ public class MessageSourceAutoConfiguration {
private Resource[] getResources(ClassLoader classLoader, String name) {
try {
return new PathMatchingResourcePatternResolver(classLoader)
return new ExtendedPathMatchingResourcePatternResolver(classLoader)
.getResources("classpath*:" + name + "*.properties");
}
catch (IOException ex) {
@ -128,4 +135,67 @@ public class MessageSourceAutoConfiguration {
}
/**
* Extended version of {@link PathMatchingResourcePatternResolver} to deal with the
* fact that "{@code classpath*:...*.properties}" patterns don't work with
* {@link URLClassLoader}s.
*/
private static class ExtendedPathMatchingResourcePatternResolver extends
PathMatchingResourcePatternResolver {
private static final Log logger = LogFactory
.getLog(PathMatchingResourcePatternResolver.class);
public ExtendedPathMatchingResourcePatternResolver(ClassLoader classLoader) {
super(classLoader);
}
@Override
protected Resource[] findAllClassPathResources(String location)
throws IOException {
String path = location;
if (path.startsWith("/")) {
path = path.substring(1);
}
if ("".equals(path)) {
Set<Resource> result = new LinkedHashSet<Resource>(16);
result.addAll(Arrays.asList(super.findAllClassPathResources(location)));
addAllClassLoaderJarUrls(getClassLoader(), result);
return result.toArray(new Resource[result.size()]);
}
return super.findAllClassPathResources(location);
}
private void addAllClassLoaderJarUrls(ClassLoader classLoader,
Set<Resource> result) {
if (classLoader != null) {
if (classLoader instanceof URLClassLoader) {
addAllClassLoaderJarUrls(((URLClassLoader) classLoader).getURLs(),
result);
}
addAllClassLoaderJarUrls(classLoader.getParent(), result);
}
}
private void addAllClassLoaderJarUrls(URL[] urls, Set<Resource> result) {
for (URL url : urls) {
if ("file".equals(url.getProtocol())
&& url.toString().toLowerCase().endsWith(".jar")) {
try {
URL jarUrl = new URL("jar:" + url.toString() + "!/");
jarUrl.openConnection();
result.add(convertClassLoaderURL(jarUrl));
}
catch (Exception ex) {
if (logger.isWarnEnabled()) {
logger.warn("Cannot search for matching files underneath "
+ url + " because it cannot be accessed as a JAR", ex);
}
}
}
}
}
}
}

View File

@ -127,6 +127,7 @@ public class AuthenticationManagerConfiguration extends
GlobalAuthenticationConfigurerAdapter {
private AuthenticationManagerBuilder defaultAuth;
private AuthenticationManager parent;
public void configureParent(AuthenticationManagerBuilder auth) {