diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfiguration.java
index f0d1ca86f24..ea335dd1c44 100644
--- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfiguration.java
+++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfiguration.java
@@ -81,14 +81,12 @@ import org.springframework.util.StringUtils;
* into a Spring Boot enabled application. By default a SSH daemon is started on port
* 2000. If the CRaSH Telnet plugin is available on the classpath, Telnet daemon will be
* launched on port 5000.
- *
*
* The default shell authentication method uses a username and password combination. If no
* configuration is provided the default username is 'user' and the password will be
* printed to console during application startup. Those default values can be overridden
* by using shell.auth.simple.username and
* shell.auth.simple.password.
- *
*
* If a Spring Security {@link AuthenticationManager} is detected, this configuration will
* create a {@link CRaSHPlugin} to forward shell authentication requests to Spring
@@ -98,21 +96,19 @@ import org.springframework.util.StringUtils;
* restricted to users having roles that match those configured in
* {@link ManagementServerProperties}. Required roles can be overridden by
* shell.auth.spring.roles.
- *
*
* To add customizations to the shell simply define beans of type {@link CRaSHPlugin} in
* the application context. Those beans will get auto detected during startup and
* registered with the underlying shell infrastructure. To configure plugins and the CRaSH
* infrastructure add beans of type {@link CrshShellProperties} to the application
* context.
- *
*
* Additional shell commands can be implemented using the guide and documentation at crashub.org. By default Boot will search for commands
* using the following classpath scanning pattern classpath*:/commands/**. To
* add different locations or override the default use
* shell.command_path_patterns in your application configuration.
- *
+ *
* @author Christian Dupuis
* @see ShellProperties
*/
diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfigurationTests.java
index d5344afce4c..59a999ced6c 100644
--- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfigurationTests.java
+++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfigurationTests.java
@@ -58,7 +58,7 @@ import static org.junit.Assert.assertTrue;
/**
* Tests for {@link CrshAutoConfiguration}.
- *
+ *
* @author Christian Dupuis
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationPackages.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationPackages.java
index feac237c8c3..9058bce6b7a 100644
--- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationPackages.java
+++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationPackages.java
@@ -48,7 +48,7 @@ public abstract class AutoConfigurationPackages {
/**
* Determine if the auto-configuration base packages for the given bean factory are
- * available
+ * available.
* @param beanFactory the source bean factory
* @return true if there are auto-config packages available
*/
diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java
index 2ad3a9a0576..455d41dca6a 100644
--- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java
+++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java
@@ -1,5 +1,5 @@
/*
-On * Copyright 2012-2014 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-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchAutoConfiguration.java
index 8074b947050..116cb4d9c66 100644
--- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchAutoConfiguration.java
+++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchAutoConfiguration.java
@@ -32,7 +32,7 @@ import org.springframework.util.StringUtils;
/**
* {@link org.springframework.boot.autoconfigure.EnableAutoConfiguration
* Auto-configuration} for Elasticsearch.
- *
+ *
* @author Artur Konczak
* @author Mohsin Husen
* @author Andy Wilkinson
@@ -54,17 +54,19 @@ public class ElasticsearchAutoConfiguration implements DisposableBean {
@Bean
public Client elasticsearchClient() {
try {
- if (StringUtils.hasLength(this.properties.getClusterNodes())) {
- this.client = createTransportClient();
- }
- else {
- this.client = createNodeClient();
- }
+ this.client = createClient();
+ return this.client;
}
catch (Exception ex) {
throw new IllegalStateException(ex);
}
- return this.client;
+ }
+
+ private Client createClient() throws Exception {
+ if (StringUtils.hasLength(this.properties.getClusterNodes())) {
+ return createTransportClient();
+ }
+ return createNodeClient();
}
private Client createNodeClient() throws Exception {
diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchProperties.java
index 45686af5efd..c93886a69af 100644
--- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchProperties.java
+++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchProperties.java
@@ -20,7 +20,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* Configuration properties for Elasticsearch.
- *
+ *
* @author Artur Konczak
* @author Mohsin Husen
* @since 1.1.0
diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/integration/IntegrationAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/integration/IntegrationAutoConfiguration.java
index 154f313dbdb..0030e686363 100644
--- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/integration/IntegrationAutoConfiguration.java
+++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/integration/IntegrationAutoConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 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.
@@ -32,7 +32,7 @@ import org.springframework.integration.jmx.config.IntegrationMBeanExportConfigur
*
* @author Artem Bilan
* @author Dave Syer
- * @since 1.1
+ * @since 1.1.0
*/
@Configuration
@ConditionalOnClass(EnableIntegration.class)
diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration.java
index 61e47ec5335..79e47e804b0 100644
--- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration.java
+++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration.java
@@ -49,7 +49,7 @@ import com.fasterxml.jackson.datatype.jsr310.JSR310Module;
*
auto-registration for all {@link Module} beans with all {@link ObjectMapper} beans
* (including the defaulted ones).
*
- *
+ *
* @author Oliver Gierke
* @since 1.1.0
*/
@@ -65,33 +65,29 @@ public class JacksonAutoConfiguration {
private ListableBeanFactory beanFactory;
@Bean
- @ConditionalOnMissingBean
@Primary
+ @ConditionalOnMissingBean
public ObjectMapper jacksonObjectMapper() {
-
ObjectMapper objectMapper = new ObjectMapper();
-
if (this.properties.isJsonSortKeys()) {
objectMapper.configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true);
}
-
return objectMapper;
}
@PostConstruct
- public void init() {
-
- Collection mappers = BeanFactoryUtils
- .beansOfTypeIncludingAncestors(this.beanFactory, ObjectMapper.class)
- .values();
- Collection modules = BeanFactoryUtils.beansOfTypeIncludingAncestors(
- this.beanFactory, Module.class).values();
-
- for (ObjectMapper mapper : mappers) {
- mapper.registerModules(modules);
+ private void registerModulesWithObjectMappers() {
+ Collection modules = getBeans(Module.class);
+ for (ObjectMapper objectMapper : getBeans(ObjectMapper.class)) {
+ objectMapper.registerModules(modules);
}
}
+ private Collection getBeans(Class type) {
+ return BeanFactoryUtils.beansOfTypeIncludingAncestors(this.beanFactory, type)
+ .values();
+ }
+
@Configuration
@ConditionalOnClass(JodaModule.class)
static class JodaModuleAutoConfiguration {
@@ -101,6 +97,7 @@ public class JacksonAutoConfiguration {
JodaModule jacksonJodaModule() {
return new JodaModule();
}
+
}
@Configuration
@@ -113,5 +110,6 @@ public class JacksonAutoConfiguration {
JSR310Module jacksonJsr310Module() {
return new JSR310Module();
}
+
}
}
diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQAutoConfiguration.java
index 8b59e6a6f06..724eafbaed6 100644
--- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQAutoConfiguration.java
+++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQAutoConfiguration.java
@@ -53,9 +53,9 @@ import org.springframework.util.ClassUtils;
/**
* {@link org.springframework.boot.autoconfigure.EnableAutoConfiguration
- * Auto-configuration} to integrate with an HornetQ broker. If the necessary
- * classes are present, embed the broker in the application by default. Otherwise,
- * connect to a broker available on the local machine with the default settings.
+ * Auto-configuration} to integrate with an HornetQ broker. If the necessary classes are
+ * present, embed the broker in the application by default. Otherwise, connect to a broker
+ * available on the local machine with the default settings.
*
* @author Stephane Nicoll
* @since 1.1.0
diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaBaseConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaBaseConfiguration.java
index 9804de176d3..96f5af4c6b5 100644
--- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaBaseConfiguration.java
+++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaBaseConfiguration.java
@@ -58,6 +58,8 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
@Import(DataSourceInitializedPublisher.Registrar.class)
public abstract class JpaBaseConfiguration implements BeanFactoryAware {
+ private static final String[] NO_PACKAGES = new String[0];
+
private ConfigurableListableBeanFactory beanFactory;
@Autowired
@@ -118,7 +120,7 @@ public abstract class JpaBaseConfiguration implements BeanFactoryAware {
List basePackages = AutoConfigurationPackages.get(this.beanFactory);
return basePackages.toArray(new String[basePackages.size()]);
}
- return new String[0];
+ return NO_PACKAGES;
}
protected void configure(
diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfiguration.java
index 5c64e7e1f9d..f40ae221c11 100644
--- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfiguration.java
+++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfiguration.java
@@ -36,7 +36,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
/**
* {@link EnableAutoConfiguration Auto-configuration} for {@link HttpMessageConverter}s.
- *
+ *
* @author Dave Syer
* @author Christian Dupuis
* @author Piotr Maj
@@ -75,5 +75,7 @@ public class HttpMessageConvertersAutoConfiguration {
converter.setPrettyPrint(this.properties.isJsonPrettyPrint());
return converter;
}
+
}
+
}
diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunnerTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunnerTests.java
index 86a1a62c1f8..7752766a072 100644
--- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunnerTests.java
+++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunnerTests.java
@@ -16,8 +16,6 @@
package org.springframework.boot.autoconfigure.batch;
-import static org.junit.Assert.assertEquals;
-
import org.junit.Before;
import org.junit.Test;
import org.springframework.batch.core.Job;
@@ -46,6 +44,8 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.core.task.SyncTaskExecutor;
import org.springframework.transaction.PlatformTransactionManager;
+import static org.junit.Assert.assertEquals;
+
/**
* Tests for {@link JobLauncherCommandLineRunner}.
*
diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfigurationTests.java
index 528d014db6a..c0961f6cfd4 100644
--- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfigurationTests.java
+++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfigurationTests.java
@@ -57,21 +57,21 @@ public class HypermediaAutoConfigurationTests {
LinkDiscoverer discoverer = discoverers.getLinkDiscovererFor(MediaTypes.HAL_JSON);
assertTrue(HalLinkDiscoverer.class.isInstance(discoverer));
}
-
+
@Test
public void doesBackOffIfEnableHypermediaSupportIsDeclaredManually() {
-
+
this.context = new AnnotationConfigWebApplicationContext();
this.context.register(SampleConfig.class, HypermediaAutoConfiguration.class);
this.context.refresh();
-
+
this.context.getBean(LinkDiscoverers.class);
}
-
+
@Configuration
@EnableHypermediaSupport(type = HypermediaType.HAL)
static class SampleConfig {
-
+
}
}
diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java
index 455a5c46a1c..fc19d2ac7f1 100644
--- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java
+++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java
@@ -17,9 +17,8 @@
package org.springframework.boot.autoconfigure.jackson;
import java.io.IOException;
-import java.util.Collection;
+import java.util.Map;
-import org.hamcrest.Matchers;
import org.joda.time.LocalDateTime;
import org.junit.After;
import org.junit.Before;
@@ -40,6 +39,7 @@ import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.datatype.joda.JodaModule;
+import static org.hamcrest.Matchers.greaterThanOrEqualTo;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
@@ -50,7 +50,7 @@ import static org.mockito.Mockito.verify;
/**
* Tests for {@link JacksonAutoConfiguration}.
- *
+ *
* @author Dave Syer
* @author Oliver Gierke
*/
@@ -72,27 +72,20 @@ public class JacksonAutoConfigurationTests {
@Test
public void registersJodaModuleAutomatically() {
-
this.context.register(JacksonAutoConfiguration.class);
this.context.refresh();
-
- Collection modules = this.context.getBeansOfType(Module.class).values();
- assertThat(modules, is(Matchers. iterableWithSize(1)));
- assertThat(modules.iterator().next(), is(instanceOf(JodaModule.class)));
-
+ Map modules = this.context.getBeansOfType(Module.class);
+ assertThat(modules.size(), greaterThanOrEqualTo(1)); // Depends on the JDK
+ assertThat(modules.get("jacksonJodaModule"), is(instanceOf(JodaModule.class)));
ObjectMapper objectMapper = this.context.getBean(ObjectMapper.class);
assertThat(objectMapper.canSerialize(LocalDateTime.class), is(true));
}
@Test
public void customJacksonModules() throws Exception {
-
- this.context = new AnnotationConfigApplicationContext();
this.context.register(ModulesConfig.class, JacksonAutoConfiguration.class);
this.context.refresh();
-
ObjectMapper mapper = this.context.getBean(ObjectMapper.class);
-
@SuppressWarnings({ "unchecked", "unused" })
ObjectMapper result = verify(mapper).registerModules(
(Iterable) argThat(hasItem(this.context.getBean("jacksonModule",
@@ -101,12 +94,9 @@ public class JacksonAutoConfigurationTests {
@Test
public void doubleModuleRegistration() throws Exception {
-
- this.context = new AnnotationConfigApplicationContext();
this.context.register(DoubleModulesConfig.class,
HttpMessageConvertersAutoConfiguration.class);
this.context.refresh();
-
ObjectMapper mapper = this.context.getBean(ObjectMapper.class);
assertEquals("{\"foo\":\"bar\"}", mapper.writeValueAsString(new Foo()));
}
@@ -124,6 +114,7 @@ public class JacksonAutoConfigurationTests {
public ObjectMapper objectMapper() {
return Mockito.mock(ObjectMapper.class);
}
+
}
@Configuration
@@ -153,6 +144,7 @@ public class JacksonAutoConfigurationTests {
mapper.registerModule(jacksonModule());
return mapper;
}
+
}
protected static class Foo {
@@ -160,7 +152,6 @@ public class JacksonAutoConfigurationTests {
private String name;
private Foo() {
-
}
static Foo create() {
@@ -176,4 +167,5 @@ public class JacksonAutoConfigurationTests {
}
}
+
}
diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/CustomHibernateJpaAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/CustomHibernateJpaAutoConfigurationTests.java
index 9adb8d8a2a1..8595b34de42 100644
--- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/CustomHibernateJpaAutoConfigurationTests.java
+++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/CustomHibernateJpaAutoConfigurationTests.java
@@ -16,11 +16,6 @@
package org.springframework.boot.autoconfigure.orm.jpa;
-import static org.hamcrest.Matchers.equalTo;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.nullValue;
-import static org.junit.Assert.assertThat;
-
import javax.sql.DataSource;
import org.junit.After;
@@ -34,6 +29,10 @@ import org.springframework.boot.test.EnvironmentTestUtils;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.nullValue;
+import static org.junit.Assert.assertThat;
+
/**
* Tests for {@link HibernateJpaAutoConfiguration}.
*
@@ -66,7 +65,7 @@ public class CustomHibernateJpaAutoConfigurationTests {
String actual = bean.getHibernateProperties(dataSource).get(
"hibernate.hbm2ddl.auto");
// Default is generic and safe
- assertThat(actual, is(nullValue()));
+ assertThat(actual, nullValue());
}
@Test
diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/reactor/ReactorAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/reactor/ReactorAutoConfigurationTests.java
index a84e5940810..b5f15121439 100644
--- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/reactor/ReactorAutoConfigurationTests.java
+++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/reactor/ReactorAutoConfigurationTests.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.
@@ -16,8 +16,6 @@
package org.springframework.boot.autoconfigure.reactor;
-import static org.junit.Assert.assertNotNull;
-
import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
@@ -27,7 +25,11 @@ import reactor.core.Environment;
import reactor.core.Reactor;
import reactor.core.spec.Reactors;
+import static org.junit.Assert.assertNotNull;
+
/**
+ * Tests for {@link ReactorAutoConfiguration}.
+ *
* @author Dave Syer
*/
public class ReactorAutoConfigurationTests {
diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/jpa/JpaUserDetailsTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/jpa/JpaUserDetailsTests.java
index 012d395db56..9687d5cfc37 100644
--- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/jpa/JpaUserDetailsTests.java
+++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/jpa/JpaUserDetailsTests.java
@@ -1,9 +1,32 @@
+/*
+ * 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.autoconfigure.security.jpa;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
+import org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration;
+import org.springframework.boot.autoconfigure.security.user.SecurityConfig;
import org.springframework.boot.test.SpringApplicationConfiguration;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Import;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
@@ -13,11 +36,9 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
* their instantiation order was accelerated by Security).
*
* @author Dave Syer
- *
- * @since 1.1
*/
@RunWith(SpringJUnit4ClassRunner.class)
-@SpringApplicationConfiguration(classes = Main.class)
+@SpringApplicationConfiguration(classes = JpaUserDetailsTests.Main.class)
public class JpaUserDetailsTests {
@Test
@@ -28,4 +49,10 @@ public class JpaUserDetailsTests {
SpringApplication.run(Main.class, args);
}
-}
\ No newline at end of file
+ @Import({ DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class,
+ PropertyPlaceholderAutoConfiguration.class, SecurityAutoConfiguration.class })
+ @ComponentScan(basePackageClasses = SecurityConfig.class)
+ public static class Main {
+ }
+
+}
diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/jpa/Main.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/jpa/Main.java
deleted file mode 100644
index e20801f6e22..00000000000
--- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/jpa/Main.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2012-2013 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.autoconfigure.security.jpa;
-
-import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
-import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
-import org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration;
-import org.springframework.boot.autoconfigure.security.user.SecurityConfig;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.Import;
-
-@Import({ DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class,
- PropertyPlaceholderAutoConfiguration.class, SecurityAutoConfiguration.class })
-@ComponentScan(basePackageClasses = SecurityConfig.class)
-public class Main {
-}
\ No newline at end of file
diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/user/SecurityConfig.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/user/SecurityConfig.java
index 1e76db91fac..c9d53b22e0b 100644
--- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/user/SecurityConfig.java
+++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/user/SecurityConfig.java
@@ -1,4 +1,3 @@
-
package org.springframework.boot.autoconfigure.security.user;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/user/User.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/user/User.java
index 60d371c9803..2c1d7b3482d 100644
--- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/user/User.java
+++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/user/User.java
@@ -1,40 +1,60 @@
-package org.springframework.boot.autoconfigure.security.user;
-
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-
-@Entity
-public class User {
- @Id
- @GeneratedValue
- private Long id;
- private String email;
-
- public User() {
- }
-
- public User(String email) {
- this.email = email;
- }
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getEmail() {
- return email;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
- @Override
- public String toString() {
- return getClass().getSimpleName() + ":" + id;
- }
-}
+/*
+ * 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.autoconfigure.security.user;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+@Entity
+public class User {
+
+ @Id
+ @GeneratedValue
+ private Long id;
+
+ private String email;
+
+ public User() {
+ }
+
+ public User(String email) {
+ this.email = email;
+ }
+
+ public Long getId() {
+ return this.id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getEmail() {
+ return this.email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + ":" + this.id;
+ }
+
+}
diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/user/UserRepository.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/user/UserRepository.java
index acefef24de6..0c3086087e4 100644
--- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/user/UserRepository.java
+++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/user/UserRepository.java
@@ -1,7 +1,25 @@
+/*
+ * 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.autoconfigure.security.user;
import org.springframework.data.jpa.repository.JpaRepository;
public interface UserRepository extends JpaRepository {
+
public User findByEmail(String email);
-}
\ No newline at end of file
+
+}
diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfigurationTests.java
index 7679216d1a0..7f5661ac27f 100644
--- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfigurationTests.java
+++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfigurationTests.java
@@ -30,13 +30,13 @@ import static org.junit.Assert.assertTrue;
/**
* Tests for {@link HttpMessageConvertersAutoConfiguration}.
- *
+ *
* @author Dave Syer
* @author Oliver Gierke
*/
public class HttpMessageConvertersAutoConfigurationTests {
- private AnnotationConfigApplicationContext context;
+ private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();;
@After
public void close() {
@@ -47,17 +47,13 @@ public class HttpMessageConvertersAutoConfigurationTests {
@Test
public void customJacksonConverter() throws Exception {
-
- this.context = new AnnotationConfigApplicationContext();
this.context.register(JacksonConfig.class,
HttpMessageConvertersAutoConfiguration.class);
this.context.refresh();
-
MappingJackson2HttpMessageConverter converter = this.context
.getBean(MappingJackson2HttpMessageConverter.class);
assertEquals(this.context.getBean(ObjectMapper.class),
converter.getObjectMapper());
-
HttpMessageConverters converters = this.context
.getBean(HttpMessageConverters.class);
assertTrue(converters.getConverters().contains(converter));
@@ -77,5 +73,7 @@ public class HttpMessageConvertersAutoConfigurationTests {
public ObjectMapper objectMapper() {
return new ObjectMapper();
}
+
}
+
}
diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfigurationTests.java
index af9ebee085d..2d9ae19570c 100644
--- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfigurationTests.java
+++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfigurationTests.java
@@ -319,7 +319,7 @@ public class WebMvcAutoConfigurationTests {
}
@Configuration
- protected static class Config {
+ public static class Config {
@Bean
public EmbeddedServletContainerFactory containerFactory() {
diff --git a/spring-boot-autoconfigure/src/test/resources/db/changelog/db.changelog-city.yaml b/spring-boot-autoconfigure/src/test/resources/db/changelog/db.changelog-city.yaml
index ae263b108a6..844d6614539 100644
--- a/spring-boot-autoconfigure/src/test/resources/db/changelog/db.changelog-city.yaml
+++ b/spring-boot-autoconfigure/src/test/resources/db/changelog/db.changelog-city.yaml
@@ -33,4 +33,3 @@ databaseChangeLog:
type: varchar(50)
constraints:
nullable: true
-
\ No newline at end of file
diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DependencyResolutionContext.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DependencyResolutionContext.java
index 0490ba145a5..b818b26a8a7 100644
--- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DependencyResolutionContext.java
+++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DependencyResolutionContext.java
@@ -26,7 +26,7 @@ import org.springframework.boot.dependency.tools.ManagedDependencies;
/**
* Context used when resolving dependencies.
- *
+ *
* @author Andy Wilkinson
* @since 1.1.0
*/
@@ -52,7 +52,7 @@ public class DependencyResolutionContext {
managedDependencies);
this.managedDependencies = new ArrayList(
new ManagedDependenciesFactory(managedDependencies)
- .getManagedDependencies());
+ .getManagedDependencies());
}
public ArtifactCoordinatesResolver getArtifactCoordinatesResolver() {
diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/ReproIntegrationTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/ReproIntegrationTests.java
index 971ddcb5da4..df32d9b3b06 100644
--- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/ReproIntegrationTests.java
+++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/ReproIntegrationTests.java
@@ -25,7 +25,7 @@ import static org.junit.Assert.assertThat;
/**
* Integration tests to exercise and reproduce specific issues.
- *
+ *
* @author Phillip Webb
* @author Andy Wilkinson
*/
diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngineTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngineTests.java
index 93e4407a630..118445a90c3 100644
--- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngineTests.java
+++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngineTests.java
@@ -35,7 +35,7 @@ import static org.junit.Assert.assertTrue;
/**
* Tests for {@link AetherGrapeEngine}.
- *
+ *
* @author Andy Wilkinson
*/
public class AetherGrapeEngineTests {
@@ -45,7 +45,7 @@ public class AetherGrapeEngineTests {
private final AetherGrapeEngine grapeEngine = AetherGrapeEngineFactory.create(
this.groovyClassLoader, Arrays.asList(new RepositoryConfiguration("central",
URI.create("http://repo1.maven.org/maven2"), false)),
- new DependencyResolutionContext());
+ new DependencyResolutionContext());
@Test
public void dependencyResolution() {
diff --git a/spring-boot-cli/src/test/resources/repro-samples/data-jpa.groovy b/spring-boot-cli/src/test/resources/repro-samples/data-jpa.groovy
index 8470df88264..4d7105bca1e 100644
--- a/spring-boot-cli/src/test/resources/repro-samples/data-jpa.groovy
+++ b/spring-boot-cli/src/test/resources/repro-samples/data-jpa.groovy
@@ -9,4 +9,5 @@ class Sample implements CommandLineRunner {
void run(String... args) {
println "Hello World"
}
-}
\ No newline at end of file
+
+}
diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/SpringBootPlugin.groovy b/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/SpringBootPlugin.groovy
index 2977b919280..b1fd5ce19b1 100644
--- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/SpringBootPlugin.groovy
+++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/SpringBootPlugin.groovy
@@ -21,7 +21,6 @@ import org.gradle.api.Project
import org.gradle.api.plugins.ApplicationPlugin
import org.gradle.api.plugins.BasePlugin
import org.gradle.api.plugins.JavaPlugin
-import org.gradle.api.tasks.compile.Compile
import org.springframework.boot.gradle.agent.AgentPluginFeatures
import org.springframework.boot.gradle.repackage.RepackagePluginFeatures
import org.springframework.boot.gradle.resolve.ResolvePluginFeatures
@@ -48,11 +47,14 @@ class SpringBootPlugin implements Plugin {
new RepackagePluginFeatures().apply(project)
new RunPluginFeatures().apply(project)
- // default to UTF-8 encoding
- project.tasks.withType(Compile).all { t->
- t.doFirst {
- if(!t.options.encoding) {
- t.options.encoding = 'UTF-8'
+ useUtf8Encoding(project)
+ }
+
+ private useUtf8Encoding(Project project) {
+ project.tasks.withType(org.gradle.api.tasks.compile.Compile).all {
+ it.doFirst {
+ if(!it.options.encoding) {
+ it.options.encoding = 'UTF-8'
}
}
}
diff --git a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java
index 96e76d6e15b..41187175b15 100644
--- a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java
+++ b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java
@@ -383,10 +383,6 @@ public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProc
/**
* Convenience class to flatten out a tree of property sources without losing the
* reference to the backing data (which can therefore be updated in the background).
- *
- * @param propertySources some PropertySources, possibly containing environment
- * properties
- * @return another PropertySources containing the same properties
*/
private static class FlatPropertySources implements PropertySources {
@@ -414,7 +410,7 @@ public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProc
private MutablePropertySources getFlattened() {
MutablePropertySources result = new MutablePropertySources();
- for (PropertySource> propertySource : propertySources) {
+ for (PropertySource> propertySource : this.propertySources) {
flattenPropertySources(propertySource, result);
}
return result;