diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayDataSource.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayDataSource.java
index 4a97a90616..76a5143266 100644
--- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayDataSource.java
+++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayDataSource.java
@@ -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 @Primary
.
*
* @author Dave Syer
+ * @since 1.1.0
*/
@Target({ ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.TYPE,
ElementType.ANNOTATION_TYPE })
diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java
index e7e6f0de36..b190dea766 100644
--- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java
+++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java
@@ -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) {
diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfiguration.java
index 86a9389188..898a63898d 100644
--- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfiguration.java
+++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfiguration.java
@@ -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
diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfiguration.java
index 2d6a944be0..5551130e87 100644
--- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfiguration.java
+++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfiguration.java
@@ -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
diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java
index ba969cb41a..771ee1ff29 100644
--- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java
+++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java
@@ -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
*/
diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfigurationTests.java
index 4348e74799..175b96fcd6 100644
--- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfigurationTests.java
+++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfigurationTests.java
@@ -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);
diff --git a/spring-boot-docs/src/main/asciidoc/howto.adoc b/spring-boot-docs/src/main/asciidoc/howto.adoc
index c8c4ae5f01..31044f7ea6 100644
--- a/spring-boot-docs/src/main/asciidoc/howto.adoc
+++ b/spring-boot-docs/src/main/asciidoc/howto.adoc
@@ -1210,8 +1210,8 @@ that can be used to disable the migrations, or switch off the location checking.
By default Flyway will autowire the (`@Primary`) `DataSource` in your context and
use that for migrations. If you like to use a different `DataSource` you can create
one and mark its `@Bean` as `@FlywayDataSource` - if you do that remember to create
-another one and mark it as `@Primary` if you want 2 data sources.
-Or you can use Flyway's native `DataSource` by setting `flyway.[url,user,password]`
+another one and mark it as `@Primary` if you want 2 data sources.
+Or you can use Flyway's native `DataSource` by setting `flyway.[url,user,password]`
in external properties.
There is a {github-code}/spring-boot-samples/spring-boot-sample-flyway[Flyway sample] so
diff --git a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
index 118ed3d675..918f249af2 100644
--- a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
+++ b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
@@ -1646,14 +1646,15 @@ interaction. For Example:
}
----
+NOTE: Spring's test framework will cache application contexts between tests. Therefore,
+as long as your tests share the same configuration, the time consuming process of starting
+and stopping the server will only happen once, regardless of the number of tests that
+actually run.
+
To change the port you can add environment properties to `@IntegrationTest` as colon- or
equals-separated name-value pairs, e.g. `@IntegrationTest("server.port:9000")`.
-
-As long as you use the same configuration, the context will be cached amongst different
-tests by default. You can therefore use this feature to run a battery of integration tests
-where the server would actually start prior to the tests. In that case, it would be better
-to make sure that your integration tests use a random port for the main server and the
-management one, something like:
+Additionally you can set the `server.port` and `management.port` properties to `0`
+in order to run your integration tests using random ports. For example:
[source,java,indent=0,subs="verbatim,quotes,attributes"]
----
@@ -1661,13 +1662,18 @@ management one, something like:
@SpringApplicationConfiguration(classes = MyApplication.class)
@WebAppConfiguration
@IntegrationTest({"server.port=0", "management.port=0"})
- public class SomeIntegrationTests { ... }
+ public class SomeIntegrationTests {
+
+ // ...
+ }
----
See <> for a description of how you can discover
the actual port that was allocated for the duration of the tests.
+
+
[[boot-features-test-utilities]]
=== Test utilities
A few test utility classes are packaged as part of `spring-boot` that are generally
diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourcesPropertyValues.java b/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourcesPropertyValues.java
index 5bb7cd1bb9..d50efa524b 100644
--- a/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourcesPropertyValues.java
+++ b/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourcesPropertyValues.java
@@ -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.
diff --git a/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java
index 5ba71a07c3..bf45646b26 100644
--- a/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java
+++ b/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java
@@ -179,8 +179,8 @@ public class ConfigFileApplicationListener implements
try {
binder.bindPropertiesToTarget();
}
- catch (BindException e) {
- throw new IllegalStateException("Cannot bind to SpringApplication", e);
+ catch (BindException ex) {
+ throw new IllegalStateException("Cannot bind to SpringApplication", ex);
}
}
diff --git a/spring-boot/src/test/java/org/springframework/boot/bind/PropertySourcesBindingTests.java b/spring-boot/src/test/java/org/springframework/boot/bind/PropertySourcesBindingTests.java
index 500d189af7..ecbf62e596 100644
--- a/spring-boot/src/test/java/org/springframework/boot/bind/PropertySourcesBindingTests.java
+++ b/spring-boot/src/test/java/org/springframework/boot/bind/PropertySourcesBindingTests.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.boot.bind;
import org.junit.Test;
@@ -20,6 +36,11 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
+/**
+ * Tests for {@link PropertySourcesPropertyValues} binding.
+ *
+ * @author Dave Syer
+ */
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = TestConfig.class)
@IntegrationTest
@@ -69,4 +90,4 @@ public class PropertySourcesBindingTests {
}
}
-}
\ No newline at end of file
+}
diff --git a/spring-boot/src/test/java/org/springframework/boot/bind/SimplerPropertySourcesBindingTests.java b/spring-boot/src/test/java/org/springframework/boot/bind/SimplerPropertySourcesBindingTests.java
index a31f684707..e636ef4421 100644
--- a/spring-boot/src/test/java/org/springframework/boot/bind/SimplerPropertySourcesBindingTests.java
+++ b/spring-boot/src/test/java/org/springframework/boot/bind/SimplerPropertySourcesBindingTests.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.boot.bind;
import org.junit.Test;
@@ -19,6 +35,11 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
+/**
+ * Tests for {@link PropertySourcesPropertyValues} binding.
+ *
+ * @author Dave Syer
+ */
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = TestConfig.class)
@IntegrationTest
@@ -61,4 +82,4 @@ public class SimplerPropertySourcesBindingTests {
}
}
-}
\ No newline at end of file
+}