This commit is contained in:
Phillip Webb
2014-05-26 21:48:19 +01:00
parent 96adb87bbd
commit 6381fdcb49
12 changed files with 77 additions and 29 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2013 the original author or authors.
* Copyright 2012-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,6 +29,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
* data source, the other (main) one would normally be marked as <code>@Primary</code>.
*
* @author Dave Syer
* @since 1.1.0
*/
@Target({ ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.TYPE,
ElementType.ANNOTATION_TYPE })

View File

@@ -30,7 +30,6 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* properties into the {@link Flyway} instance.
*
* @author Dave Syer
*
* @since 1.1.0
*/
@ConfigurationProperties(prefix = "flyway", ignoreUnknownFields = true)
@@ -83,7 +82,7 @@ public class FlywayProperties {
}
public String getPassword() {
return this.password == null ? "" : this.password;
return (this.password == null ? "" : this.password);
}
public void setPassword(String password) {

View File

@@ -42,7 +42,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
*/
@Configuration
@ConditionalOnClass({ DeviceResolverHandlerInterceptor.class,
DeviceHandlerMethodArgumentResolver.class })
DeviceHandlerMethodArgumentResolver.class })
@AutoConfigureAfter(WebMvcAutoConfiguration.class)
public class DeviceResolverAutoConfiguration {
@@ -67,7 +67,7 @@ public class DeviceResolverAutoConfiguration {
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(deviceResolverHandlerInterceptor);
registry.addInterceptor(this.deviceResolverHandlerInterceptor);
}
@Override

View File

@@ -39,13 +39,13 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
* {@link EnableAutoConfiguration Auto-configuration} for Spring Mobile's
* {@link SitePreferenceHandler}. The site preference feature depends on a
* {@link DeviceResolver} first being registered.
*
*
* @author Roy Clarkson
* @since 1.1
* @since 1.1.0
*/
@Configuration
@ConditionalOnClass({ SitePreferenceHandlerInterceptor.class,
SitePreferenceHandlerMethodArgumentResolver.class })
SitePreferenceHandlerMethodArgumentResolver.class })
@AutoConfigureAfter(DeviceResolverAutoConfiguration.class)
@ConditionalOnExpression("${spring.mobile.enableSitePreference:true}")
public class SitePreferenceAutoConfiguration {
@@ -71,7 +71,7 @@ public class SitePreferenceAutoConfiguration {
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(sitePreferenceHandlerInterceptor);
registry.addInterceptor(this.sitePreferenceHandlerInterceptor);
}
@Override

View File

@@ -30,7 +30,6 @@ import org.springframework.beans.factory.BeanCreationException;
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration;
import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration;
import org.springframework.boot.test.EnvironmentTestUtils;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
@@ -40,7 +39,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
/**
* Tests for {@link LiquibaseAutoConfiguration}.
* Tests for {@link FlywayAutoConfiguration}.
*
* @author Dave Syer
*/

View File

@@ -16,9 +16,6 @@
package org.springframework.boot.autoconfigure.mobile;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
import java.lang.reflect.Field;
import java.util.List;
@@ -39,6 +36,9 @@ import org.springframework.util.ReflectionUtils;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
/**
* Tests for {@link DeviceResolverAutoConfiguration}.
*
@@ -82,7 +82,8 @@ public class DeviceResolverAutoConfigurationTests {
DeviceResolverAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class);
context.refresh();
RequestMappingHandlerMapping mapping = (RequestMappingHandlerMapping) context.getBean("requestMappingHandlerMapping");
RequestMappingHandlerMapping mapping = (RequestMappingHandlerMapping) context
.getBean("requestMappingHandlerMapping");
Field interceptorsField = ReflectionUtils.findField(
RequestMappingHandlerMapping.class, "interceptors");
interceptorsField.setAccessible(true);