diff --git a/eclipse/org.eclipse.jdt.core.prefs b/eclipse/org.eclipse.jdt.core.prefs index 24bf63fd73..7b2f879524 100644 --- a/eclipse/org.eclipse.jdt.core.prefs +++ b/eclipse/org.eclipse.jdt.core.prefs @@ -51,7 +51,7 @@ org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag +org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled @@ -102,6 +102,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disa org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.processAnnotations=disabled org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 @@ -212,7 +213,7 @@ org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert diff --git a/eclipse/org.eclipse.jdt.ui.prefs b/eclipse/org.eclipse.jdt.ui.prefs index e2b8462283..43281c1a5c 100644 --- a/eclipse/org.eclipse.jdt.ui.prefs +++ b/eclipse/org.eclipse.jdt.ui.prefs @@ -64,7 +64,7 @@ formatter_settings_version=12 org.eclipse.jdt.ui.exception.name=e org.eclipse.jdt.ui.gettersetter.use.is=false org.eclipse.jdt.ui.ignorelowercasenames=true -org.eclipse.jdt.ui.importorder=java;javax;org;com;\#; +org.eclipse.jdt.ui.importorder=java;javax;org;com;;\#; org.eclipse.jdt.ui.javadoc=true org.eclipse.jdt.ui.keywordthis=false org.eclipse.jdt.ui.ondemandthreshold=9999 @@ -87,7 +87,7 @@ sp_cleanup.always_use_this_for_non_static_method_access=false sp_cleanup.convert_to_enhanced_for_loop=false sp_cleanup.correct_indentation=false sp_cleanup.format_source_code=true -sp_cleanup.format_source_code_changes_only=false +sp_cleanup.format_source_code_changes_only=true sp_cleanup.make_local_variable_final=false sp_cleanup.make_parameters_final=false sp_cleanup.make_private_fields_final=false 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 324ff07812..9683777c9a 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 @@ -337,7 +337,7 @@ public class CrshAutoConfiguration { @Override protected Iterable> createConfigurationCapabilities() { - return Arrays.> asList(ROLES); + return Arrays.>asList(ROLES); } } @@ -457,7 +457,7 @@ public class CrshAutoConfiguration { return Collections.singletonList(((FileHandle) handle).openStream()) .iterator(); } - return Collections. emptyList().iterator(); + return Collections.emptyList().iterator(); } @Override diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpoint.java index 4233e1036c..bb5915f089 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpoint.java @@ -154,7 +154,7 @@ public class ConfigurationPropertiesReportEndpoint extends return result; } catch (Exception ex) { - return new HashMap(Collections. singletonMap( + return new HashMap(Collections.singletonMap( "error", "Cannot serialize '" + prefix + "'")); } } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ShutdownEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ShutdownEndpoint.java index 844ed1125c..5ad68a7f72 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ShutdownEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ShutdownEndpoint.java @@ -48,12 +48,12 @@ public class ShutdownEndpoint extends AbstractEndpoint> impl public Map invoke() { if (this.context == null) { - return Collections. singletonMap("message", + return Collections.singletonMap("message", "No context to shutdown."); } try { - return Collections. singletonMap("message", + return Collections.singletonMap("message", "Shutting down, bye..."); } finally { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/listener/AuditListenerTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/listener/AuditListenerTests.java index 363f89e262..639c899c63 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/listener/AuditListenerTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/listener/AuditListenerTests.java @@ -36,7 +36,7 @@ public class AuditListenerTests { public void testStoredEvents() { AuditEventRepository repository = mock(AuditEventRepository.class); AuditEvent event = new AuditEvent("principal", "type", - Collections. emptyMap()); + Collections.emptyMap()); AuditListener listener = new AuditListener(repository); listener.onApplicationEvent(new AuditApplicationEvent(event)); verify(repository).add(event); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfigurationTests.java index 8d55c718a4..871098beae 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfigurationTests.java @@ -198,7 +198,7 @@ public class EndpointAutoConfigurationTests { @Override public Collection> metrics() { Metric metric = new Metric("foo", 1); - return Collections.> singleton(metric); + return Collections.>singleton(metric); } }; } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AbstractEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AbstractEndpointTests.java index 1ba977e514..cceacf479a 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AbstractEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AbstractEndpointTests.java @@ -100,7 +100,7 @@ public abstract class AbstractEndpointTests> { public void isSensitiveOverride() throws Exception { this.context = new AnnotationConfigApplicationContext(); PropertySource propertySource = new MapPropertySource("test", - Collections. singletonMap(this.property + ".sensitive", + Collections.singletonMap(this.property + ".sensitive", String.valueOf(!this.sensitive))); this.context.getEnvironment().getPropertySources().addFirst(propertySource); this.context.register(this.configClass); @@ -117,7 +117,7 @@ public abstract class AbstractEndpointTests> { public void isEnabledFallbackToEnvironment() throws Exception { this.context = new AnnotationConfigApplicationContext(); PropertySource propertySource = new MapPropertySource("test", - Collections. singletonMap(this.property + ".enabled", + Collections.singletonMap(this.property + ".enabled", false)); this.context.getEnvironment().getPropertySources().addFirst(propertySource); this.context.register(this.configClass); @@ -130,7 +130,7 @@ public abstract class AbstractEndpointTests> { public void isExplicitlyEnabled() throws Exception { this.context = new AnnotationConfigApplicationContext(); PropertySource propertySource = new MapPropertySource("test", - Collections. singletonMap(this.property + ".enabled", + Collections.singletonMap(this.property + ".enabled", false)); this.context.getEnvironment().getPropertySources().addFirst(propertySource); this.context.register(this.configClass); @@ -143,7 +143,7 @@ public abstract class AbstractEndpointTests> { public void isAllEndpointsDisabled() throws Exception { this.context = new AnnotationConfigApplicationContext(); PropertySource propertySource = new MapPropertySource("test", - Collections. singletonMap("endpoints.enabled", false)); + Collections.singletonMap("endpoints.enabled", false)); this.context.getEnvironment().getPropertySources().addFirst(propertySource); this.context.register(this.configClass); this.context.refresh(); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/MetricsEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/MetricsEndpointTests.java index 5920c45e4c..5eb60461a3 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/MetricsEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/MetricsEndpointTests.java @@ -106,7 +106,7 @@ public class MetricsEndpointTests extends AbstractEndpointTests PublicMetrics metrics = new PublicMetrics() { @Override public Collection> metrics() { - return Collections.> singleton(metric); + return Collections.>singleton(metric); } }; return new MetricsEndpoint(metrics); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpointTests.java index 5cf9d8eb17..0cf90b0066 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpointTests.java @@ -53,7 +53,7 @@ public class RequestMappingEndpointTests { mapping.setApplicationContext(new StaticApplicationContext()); mapping.initApplicationContext(); this.endpoint.setHandlerMappings(Collections - . singletonList(mapping)); + .singletonList(mapping)); Map result = this.endpoint.invoke(); assertEquals(1, result.size()); @SuppressWarnings("unchecked") @@ -114,7 +114,7 @@ public class RequestMappingEndpointTests { mapping.setApplicationContext(new StaticApplicationContext()); mapping.afterPropertiesSet(); this.endpoint.setMethodMappings(Collections - .> singletonList(mapping)); + .>singletonList(mapping)); Map result = this.endpoint.invoke(); assertEquals(1, result.size()); assertTrue(result.keySet().iterator().next().contains("/dump")); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/TraceEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/TraceEndpointTests.java index 57f85b13d3..078ff677e8 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/TraceEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/TraceEndpointTests.java @@ -53,7 +53,7 @@ public class TraceEndpointTests extends AbstractEndpointTests { @Bean public TraceEndpoint endpoint() { TraceRepository repository = new InMemoryTraceRepository(); - repository.add(Collections. singletonMap("a", "b")); + repository.add(Collections.singletonMap("a", "b")); return new TraceEndpoint(repository); } } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HealthMvcEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HealthMvcEndpointTests.java index af07a1de72..9725be1d35 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HealthMvcEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HealthMvcEndpointTests.java @@ -50,7 +50,7 @@ import static org.mockito.Mockito.mock; public class HealthMvcEndpointTests { private static final PropertySource NON_SENSITIVE = new MapPropertySource("test", - Collections. singletonMap("endpoints.health.sensitive", + Collections.singletonMap("endpoints.health.sensitive", "false")); private HealthEndpoint endpoint = null; diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/PrefixMetricGroupExporterTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/PrefixMetricGroupExporterTests.java index 75e3639e9e..3701c92294 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/PrefixMetricGroupExporterTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/PrefixMetricGroupExporterTests.java @@ -60,7 +60,7 @@ public class PrefixMetricGroupExporterTests { @Test public void multiMetricGroupsCopiedAsDefault() { - this.reader.set("foo", Arrays.> asList(new Metric("bar", 2.3), + this.reader.set("foo", Arrays.>asList(new Metric("bar", 2.3), new Metric("spam", 1.3))); this.exporter.export(); assertEquals(1, this.writer.countGroups()); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMultiMetricRepositoryTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMultiMetricRepositoryTests.java index ddf90df480..d4c218471a 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMultiMetricRepositoryTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMultiMetricRepositoryTests.java @@ -58,7 +58,7 @@ public class RedisMultiMetricRepositoryTests { @Parameters public static List parameters() { - return Arrays. asList(new Object[] { null }, new Object[] { "test" }); + return Arrays.asList(new Object[] { null }, new Object[] { "test" }); } @Before @@ -89,26 +89,26 @@ public class RedisMultiMetricRepositoryTests { @Test public void setAndGet() { this.repository.set("foo", - Arrays.> asList(new Metric("foo.bar", 12.3))); + Arrays.>asList(new Metric("foo.bar", 12.3))); this.repository.set("foo", - Arrays.> asList(new Metric("foo.bar", 15.3))); + Arrays.>asList(new Metric("foo.bar", 15.3))); assertEquals(15.3, Iterables.collection(this.repository.findAll("foo")) .iterator().next().getValue()); } @Test public void setAndGetMultiple() { - this.repository.set("foo", Arrays.> asList(new Metric( - "foo.val", 12.3), new Metric("foo.bar", 11.3))); + this.repository.set("foo", Arrays.>asList(new Metric("foo.val", + 12.3), new Metric("foo.bar", 11.3))); assertEquals(2, Iterables.collection(this.repository.findAll("foo")).size()); } @Test public void groups() { - this.repository.set("foo", Arrays.> asList(new Metric( - "foo.val", 12.3), new Metric("foo.bar", 11.3))); - this.repository.set("bar", Arrays.> asList(new Metric( - "bar.val", 12.3), new Metric("bar.foo", 11.3))); + this.repository.set("foo", Arrays.>asList(new Metric("foo.val", + 12.3), new Metric("foo.bar", 11.3))); + this.repository.set("bar", Arrays.>asList(new Metric("bar.val", + 12.3), new Metric("bar.foo", 11.3))); Collection groups = Iterables.collection(this.repository.groups()); assertEquals(2, groups.size()); assertTrue("Wrong groups: " + groups, groups.contains("foo")); @@ -116,10 +116,10 @@ public class RedisMultiMetricRepositoryTests { @Test public void count() { - this.repository.set("foo", Arrays.> asList(new Metric( - "foo.val", 12.3), new Metric("foo.bar", 11.3))); - this.repository.set("bar", Arrays.> asList(new Metric( - "bar.val", 12.3), new Metric("bar.foo", 11.3))); + this.repository.set("foo", Arrays.>asList(new Metric("foo.val", + 12.3), new Metric("foo.bar", 11.3))); + this.repository.set("bar", Arrays.>asList(new Metric("bar.val", + 12.3), new Metric("bar.foo", 11.3))); assertEquals(2, this.repository.countGroups()); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthorizationAuditListenerTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthorizationAuditListenerTests.java index 58423c0be3..1ba2b3082e 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthorizationAuditListenerTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthorizationAuditListenerTests.java @@ -49,7 +49,7 @@ public class AuthorizationAuditListenerTests { @Test public void testAuthenticationSuccess() { this.listener.onApplicationEvent(new AuthorizationFailureEvent(this, Arrays - . asList(new SecurityConfig("USER")), + .asList(new SecurityConfig("USER")), new UsernamePasswordAuthenticationToken("user", "password"), new AccessDeniedException("Bad user"))); verify(this.publisher).publishEvent((ApplicationEvent) anyObject()); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/InMemoryTraceRepositoryTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/InMemoryTraceRepositoryTests.java index 35b71de18e..091fe9376e 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/InMemoryTraceRepositoryTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/InMemoryTraceRepositoryTests.java @@ -35,9 +35,9 @@ public class InMemoryTraceRepositoryTests { @Test public void capacityLimited() { this.repository.setCapacity(2); - this.repository.add(Collections. singletonMap("foo", "bar")); - this.repository.add(Collections. singletonMap("bar", "foo")); - this.repository.add(Collections. singletonMap("bar", "bar")); + this.repository.add(Collections.singletonMap("foo", "bar")); + this.repository.add(Collections.singletonMap("bar", "foo")); + this.repository.add(Collections.singletonMap("bar", "bar")); List traces = this.repository.findAll(); assertEquals(2, traces.size()); assertEquals("bar", traces.get(0).getInfo().get("bar")); @@ -48,9 +48,9 @@ public class InMemoryTraceRepositoryTests { public void reverseFalse() { this.repository.setReverse(false); this.repository.setCapacity(2); - this.repository.add(Collections. singletonMap("foo", "bar")); - this.repository.add(Collections. singletonMap("bar", "foo")); - this.repository.add(Collections. singletonMap("bar", "bar")); + this.repository.add(Collections.singletonMap("foo", "bar")); + this.repository.add(Collections.singletonMap("bar", "foo")); + this.repository.add(Collections.singletonMap("bar", "bar")); List traces = this.repository.findAll(); assertEquals(2, traces.size()); assertEquals("bar", traces.get(1).getInfo().get("bar")); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfiguration.java index c9dd245137..abf1ad0576 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfiguration.java @@ -16,8 +16,6 @@ package org.springframework.boot.autoconfigure.groovy.template; -import groovy.text.markup.MarkupTemplateEngine; - import java.security.CodeSource; import java.security.ProtectionDomain; @@ -44,6 +42,8 @@ import org.springframework.web.servlet.view.groovy.GroovyMarkupConfig; import org.springframework.web.servlet.view.groovy.GroovyMarkupConfigurer; import org.springframework.web.servlet.view.groovy.GroovyMarkupViewResolver; +import groovy.text.markup.MarkupTemplateEngine; + /** * Autoconfiguration support for Groovy templates in MVC. By default creates a * {@link MarkupTemplateEngine} configured from {@link GroovyTemplateProperties}, but you diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateResolver.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateResolver.java new file mode 100644 index 0000000000..8b4417df9e --- /dev/null +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateResolver.java @@ -0,0 +1,67 @@ +/* + * 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.groovy.template; + +import java.io.IOException; +import java.net.URL; + +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.web.servlet.view.groovy.GroovyMarkupConfigurer; +import org.springframework.web.servlet.view.groovy.GroovyMarkupViewResolver; + +import groovy.text.markup.MarkupTemplateEngine; +import groovy.text.markup.TemplateConfiguration; +import groovy.text.markup.TemplateResolver; + +/** + * A custom {@link groovy.text.markup.TemplateResolver template resolver} which resolves + * templates using the locale found in the thread locale. This resolver ignores the + * template engine configuration locale. + * + * @author Cédric Champeau + * @since 1.1.0 + * @deprecated since 1.2 in favor of Spring 4.1's {@link GroovyMarkupViewResolver} and + * {@link GroovyMarkupConfigurer}. + */ +@Deprecated +public class GroovyTemplateResolver implements TemplateResolver { + + private ClassLoader templateClassLoader; + + @Override + public void configure(final ClassLoader templateClassLoader, + final TemplateConfiguration configuration) { + this.templateClassLoader = templateClassLoader; + } + + @Override + public URL resolveTemplate(final String templatePath) throws IOException { + MarkupTemplateEngine.TemplateResource templateResource = MarkupTemplateEngine.TemplateResource + .parse(templatePath); + URL resource = this.templateClassLoader.getResource(templateResource.withLocale( + LocaleContextHolder.getLocale().toString().replace("-", "_")).toString()); + if (resource == null) { + // no resource found with the default locale, try without any locale + resource = this.templateClassLoader.getResource(templateResource.withLocale( + null).toString()); + } + if (resource == null) { + throw new IOException("Unable to load template:" + templatePath); + } + return resource; + } + +} diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java index d37bbb6743..e25fd0ff49 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java @@ -20,9 +20,6 @@ import javax.annotation.PostConstruct; import javax.persistence.EntityManagerFactory; import javax.sql.DataSource; -import liquibase.integration.spring.SpringLiquibase; -import liquibase.servicelocator.ServiceLocator; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; @@ -46,6 +43,9 @@ import org.springframework.orm.jpa.AbstractEntityManagerFactoryBean; import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import org.springframework.util.Assert; +import liquibase.integration.spring.SpringLiquibase; +import liquibase.servicelocator.ServiceLocator; + /** * {@link EnableAutoConfiguration Auto-configuration} for Liquibase. * diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseProperties.java index f97062ab6b..67c089da96 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseProperties.java @@ -18,10 +18,10 @@ package org.springframework.boot.autoconfigure.liquibase; import javax.validation.constraints.NotNull; -import liquibase.integration.spring.SpringLiquibase; - import org.springframework.boot.context.properties.ConfigurationProperties; +import liquibase.integration.spring.SpringLiquibase; + /** * Configuration properties to configure {@link SpringLiquibase}. * diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java index 385de50955..0f819e05b9 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java @@ -23,8 +23,6 @@ import java.util.LinkedHashMap; import javax.annotation.PostConstruct; import javax.servlet.Servlet; -import nz.net.ultraq.thymeleaf.LayoutDialect; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; @@ -54,6 +52,8 @@ import org.thymeleaf.templateresolver.TemplateResolver; import com.github.mxab.thymeleaf.extras.dataattribute.dialect.DataAttributeDialect; +import nz.net.ultraq.thymeleaf.LayoutDialect; + /** * {@link EnableAutoConfiguration Auto-configuration} for Thymeleaf. * diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java index 10f6c3d1ee..a1fe46c5d7 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java @@ -16,8 +16,6 @@ package org.springframework.boot.autoconfigure.web; -import io.undertow.Undertow; - import javax.servlet.Servlet; import org.apache.catalina.startup.Tomcat; @@ -50,6 +48,8 @@ import org.springframework.core.type.AnnotationMetadata; import org.springframework.util.ObjectUtils; import org.xnio.SslClientAuthMode; +import io.undertow.Undertow; + /** * {@link EnableAutoConfiguration Auto-configuration} for an embedded servlet containers. * diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/UndertowWebSocketContainerCustomizer.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/UndertowWebSocketContainerCustomizer.java index ad731b8c97..35eba0351e 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/UndertowWebSocketContainerCustomizer.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/UndertowWebSocketContainerCustomizer.java @@ -16,12 +16,12 @@ package org.springframework.boot.autoconfigure.websocket; -import io.undertow.servlet.api.DeploymentInfo; -import io.undertow.websockets.jsr.WebSocketDeploymentInfo; - import org.springframework.boot.context.embedded.undertow.UndertowDeploymentInfoCustomizer; import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory; +import io.undertow.servlet.api.DeploymentInfo; +import io.undertow.websockets.jsr.WebSocketDeploymentInfo; + /** * {@link WebSocketContainerCustomizer} for * {@link UndertowEmbeddedServletContainerFactory}. diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java index 3bc4cf132a..6e6f59cd2f 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java @@ -16,8 +16,6 @@ package org.springframework.boot.autoconfigure.groovy.template; -import groovy.text.markup.MarkupTemplateEngine; - import java.io.File; import java.io.StringWriter; import java.io.Writer; @@ -44,6 +42,8 @@ import org.springframework.web.servlet.view.groovy.GroovyMarkupConfig; import org.springframework.web.servlet.view.groovy.GroovyMarkupConfigurer; import org.springframework.web.servlet.view.groovy.GroovyMarkupViewResolver; +import groovy.text.markup.MarkupTemplateEngine; + import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jndi/JndiPropertiesHidingClassLoader.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jndi/JndiPropertiesHidingClassLoader.java index 17b5a9a226..10d7fccb21 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jndi/JndiPropertiesHidingClassLoader.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jndi/JndiPropertiesHidingClassLoader.java @@ -36,7 +36,7 @@ public class JndiPropertiesHidingClassLoader extends ClassLoader { @Override public Enumeration getResources(String name) throws IOException { if ("jndi.properties".equals(name)) { - return Collections.enumeration(Collections. emptyList()); + return Collections.enumeration(Collections.emptyList()); } return super.getResources(name); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java index b3a9a1f857..638f1e4553 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java @@ -16,8 +16,6 @@ package org.springframework.boot.autoconfigure.liquibase; -import liquibase.integration.spring.SpringLiquibase; - import org.junit.After; import org.junit.Before; import org.junit.Rule; @@ -31,6 +29,8 @@ import org.springframework.boot.test.EnvironmentTestUtils; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.test.util.ReflectionTestUtils; +import liquibase.integration.spring.SpringLiquibase; + import static org.hamcrest.Matchers.instanceOf; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoDataAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoDataAutoConfigurationTests.java index 8ed63ef086..49f610c590 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoDataAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoDataAutoConfigurationTests.java @@ -163,7 +163,7 @@ public class MongoDataAutoConfigurationTests { Set initialEntitySet = (Set) ReflectionTestUtils.getField( mappingContext, "initialEntitySet"); assertThat(initialEntitySet, hasSize(types.length)); - assertThat(initialEntitySet, Matchers. hasItems(types)); + assertThat(initialEntitySet, Matchers.hasItems(types)); } @Configuration diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheViewTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheViewTests.java index 8f91c6b680..9688357212 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheViewTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheViewTests.java @@ -20,7 +20,6 @@ import java.util.Collections; import org.junit.Before; import org.junit.Test; -import org.springframework.boot.autoconfigure.mustache.web.MustacheView; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.mock.web.MockServletContext; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheWebIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheWebIntegrationTests.java index 34d10d78cd..0bd259053e 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheWebIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheWebIntegrationTests.java @@ -33,8 +33,6 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; import org.springframework.boot.autoconfigure.mustache.MustacheAutoConfiguration; import org.springframework.boot.autoconfigure.mustache.MustacheResourceTemplateLoader; -import org.springframework.boot.autoconfigure.mustache.web.MustacheView; -import org.springframework.boot.autoconfigure.mustache.web.MustacheViewResolver; import org.springframework.boot.autoconfigure.mustache.web.MustacheWebIntegrationTests.Application; import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration; import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersTests.java index f5fa9b517c..0f3a5937bd 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersTests.java @@ -58,7 +58,7 @@ public class HttpMessageConvertersTests { for (HttpMessageConverter converter : converters) { converterClasses.add(converter.getClass()); } - assertThat(converterClasses, equalTo(Arrays.> asList( + assertThat(converterClasses, equalTo(Arrays.>asList( ByteArrayHttpMessageConverter.class, StringHttpMessageConverter.class, ResourceHttpMessageConverter.class, SourceHttpMessageConverter.class, AllEncompassingFormHttpMessageConverter.class, @@ -117,7 +117,7 @@ public class HttpMessageConvertersTests { for (HttpMessageConverter converter : converters) { converterClasses.add(converter.getClass()); } - assertThat(converterClasses, equalTo(Arrays.> asList( + assertThat(converterClasses, equalTo(Arrays.>asList( ByteArrayHttpMessageConverter.class, StringHttpMessageConverter.class, ResourceHttpMessageConverter.class, SourceHttpMessageConverter.class, AllEncompassingFormHttpMessageConverter.class, diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/DefaultCommandFactory.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/DefaultCommandFactory.java index ac0117ef4f..c13a6c7b89 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/DefaultCommandFactory.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/DefaultCommandFactory.java @@ -38,7 +38,7 @@ import org.springframework.boot.cli.command.test.TestCommand; */ public class DefaultCommandFactory implements CommandFactory { - private static final List DEFAULT_COMMANDS = Arrays. asList( + private static final List DEFAULT_COMMANDS = Arrays.asList( new VersionCommand(), new RunCommand(), new TestCommand(), new GrabCommand(), new JarCommand(), new InstallCommand(), new UninstallCommand(), new InitCommand()); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/grab/GrabCommand.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/grab/GrabCommand.java index e00a3301a8..32d60a12d2 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/grab/GrabCommand.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/grab/GrabCommand.java @@ -18,8 +18,6 @@ package org.springframework.boot.cli.command.grab; import java.util.List; -import joptsimple.OptionSet; - import org.springframework.boot.cli.command.Command; import org.springframework.boot.cli.command.OptionParsingCommand; import org.springframework.boot.cli.command.options.CompilerOptionHandler; @@ -31,6 +29,8 @@ import org.springframework.boot.cli.compiler.GroovyCompilerConfiguration; import org.springframework.boot.cli.compiler.RepositoryConfigurationFactory; import org.springframework.boot.cli.compiler.grape.RepositoryConfiguration; +import joptsimple.OptionSet; + /** * {@link Command} to grab the dependencies of one or more Groovy scripts * diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitCommand.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitCommand.java index ce18338a43..dd4819168e 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitCommand.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitCommand.java @@ -22,9 +22,6 @@ import java.util.Arrays; import java.util.Collection; import java.util.List; -import joptsimple.OptionSet; -import joptsimple.OptionSpec; - import org.springframework.boot.cli.command.Command; import org.springframework.boot.cli.command.HelpExample; import org.springframework.boot.cli.command.OptionParsingCommand; @@ -33,6 +30,9 @@ import org.springframework.boot.cli.command.status.ExitStatus; import org.springframework.boot.cli.util.Log; import org.springframework.util.Assert; +import joptsimple.OptionSet; +import joptsimple.OptionSpec; + /** * {@link Command} that initializes a project using Spring initializr. * diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/InstallCommand.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/InstallCommand.java index 2c44480376..632f10871f 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/InstallCommand.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/InstallCommand.java @@ -17,8 +17,6 @@ package org.springframework.boot.cli.command.install; import java.util.List; -import joptsimple.OptionSet; - import org.springframework.boot.cli.command.Command; import org.springframework.boot.cli.command.OptionParsingCommand; import org.springframework.boot.cli.command.options.CompilerOptionHandler; @@ -26,6 +24,8 @@ import org.springframework.boot.cli.command.status.ExitStatus; import org.springframework.boot.cli.util.Log; import org.springframework.util.Assert; +import joptsimple.OptionSet; + /** * {@link Command} to install additional dependencies into the CLI. * diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/Installer.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/Installer.java index 3bf72d3200..6df544f34d 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/Installer.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/Installer.java @@ -23,8 +23,6 @@ import java.io.IOException; import java.util.List; import java.util.Properties; -import joptsimple.OptionSet; - import org.springframework.boot.cli.command.options.CompilerOptionHandler; import org.springframework.boot.cli.command.options.OptionSetGroovyCompilerConfiguration; import org.springframework.boot.cli.compiler.GroovyCompilerConfiguration; @@ -34,6 +32,8 @@ import org.springframework.boot.cli.util.Log; import org.springframework.util.FileCopyUtils; import org.springframework.util.SystemPropertyUtils; +import joptsimple.OptionSet; + /** * Shared logic for the {@link InstallCommand} and {@link UninstallCommand}. * diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/UninstallCommand.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/UninstallCommand.java index 9c783cb020..f89abc296e 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/UninstallCommand.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/UninstallCommand.java @@ -18,15 +18,15 @@ package org.springframework.boot.cli.command.install; import java.util.List; -import joptsimple.OptionSet; -import joptsimple.OptionSpec; - import org.springframework.boot.cli.command.Command; import org.springframework.boot.cli.command.OptionParsingCommand; import org.springframework.boot.cli.command.options.CompilerOptionHandler; import org.springframework.boot.cli.command.status.ExitStatus; import org.springframework.boot.cli.util.Log; +import joptsimple.OptionSet; +import joptsimple.OptionSpec; + /** * {@link Command} to uninstall dependencies from the CLI's lib directory * diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/jar/JarCommand.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/jar/JarCommand.java index c2756f0c26..7c0318489e 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/jar/JarCommand.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/jar/JarCommand.java @@ -16,8 +16,6 @@ package org.springframework.boot.cli.command.jar; -import groovy.lang.Grab; - import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -31,9 +29,6 @@ import java.util.Arrays; import java.util.List; import java.util.jar.Manifest; -import joptsimple.OptionSet; -import joptsimple.OptionSpec; - import org.codehaus.groovy.ast.ASTNode; import org.codehaus.groovy.ast.AnnotatedNode; import org.codehaus.groovy.ast.AnnotationNode; @@ -65,6 +60,10 @@ import org.springframework.core.io.Resource; import org.springframework.core.io.support.PathMatchingResourcePatternResolver; import org.springframework.util.Assert; +import groovy.lang.Grab; +import joptsimple.OptionSet; +import joptsimple.OptionSpec; + /** * {@link Command} to create a self-contained executable jar file from a CLI application * diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHandler.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHandler.java index d3bad2b0a0..abee0a78b1 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHandler.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHandler.java @@ -16,8 +16,6 @@ package org.springframework.boot.cli.command.options; -import groovy.lang.Closure; - import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; @@ -31,6 +29,10 @@ import java.util.Map; import java.util.Set; import java.util.TreeSet; +import org.springframework.boot.cli.command.OptionParsingCommand; +import org.springframework.boot.cli.command.status.ExitStatus; + +import groovy.lang.Closure; import joptsimple.BuiltinHelpFormatter; import joptsimple.HelpFormatter; import joptsimple.OptionDescriptor; @@ -38,9 +40,6 @@ import joptsimple.OptionParser; import joptsimple.OptionSet; import joptsimple.OptionSpecBuilder; -import org.springframework.boot.cli.command.OptionParsingCommand; -import org.springframework.boot.cli.command.status.ExitStatus; - /** * Delegate used by {@link OptionParsingCommand} to parse options and run the command. * diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionSetGroovyCompilerConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionSetGroovyCompilerConfiguration.java index 7018cc649c..7c07d7e74e 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionSetGroovyCompilerConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionSetGroovyCompilerConfiguration.java @@ -18,14 +18,14 @@ package org.springframework.boot.cli.command.options; import java.util.List; -import joptsimple.OptionSet; -import joptsimple.OptionSpec; - import org.springframework.boot.cli.compiler.GroovyCompilerConfiguration; import org.springframework.boot.cli.compiler.GroovyCompilerScope; import org.springframework.boot.cli.compiler.RepositoryConfigurationFactory; import org.springframework.boot.cli.compiler.grape.RepositoryConfiguration; +import joptsimple.OptionSet; +import joptsimple.OptionSpec; + /** * Simple adapter class to present an {@link OptionSet} as a * {@link GroovyCompilerConfiguration} diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/SourceOptions.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/SourceOptions.java index 4bf179c1ef..0c1a03a484 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/SourceOptions.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/SourceOptions.java @@ -20,11 +20,11 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import joptsimple.OptionSet; - import org.springframework.boot.cli.util.ResourceUtils; import org.springframework.util.Assert; +import joptsimple.OptionSet; + /** * Extract source file options (anything following '--' in an {@link OptionSet}). * diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/RunCommand.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/RunCommand.java index 2798f092fa..efb387f295 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/RunCommand.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/RunCommand.java @@ -20,9 +20,6 @@ import java.io.File; import java.util.List; import java.util.logging.Level; -import joptsimple.OptionSet; -import joptsimple.OptionSpec; - import org.springframework.boot.cli.command.Command; import org.springframework.boot.cli.command.OptionParsingCommand; import org.springframework.boot.cli.command.options.CompilerOptionHandler; @@ -33,6 +30,9 @@ import org.springframework.boot.cli.compiler.GroovyCompilerScope; import org.springframework.boot.cli.compiler.RepositoryConfigurationFactory; import org.springframework.boot.cli.compiler.grape.RepositoryConfiguration; +import joptsimple.OptionSet; +import joptsimple.OptionSpec; + import static java.util.Arrays.asList; /** diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/AnsiString.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/AnsiString.java index 664a2049db..f2ebc6ba40 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/AnsiString.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/AnsiString.java @@ -16,11 +16,11 @@ package org.springframework.boot.cli.command.shell; -import jline.Terminal; - import org.fusesource.jansi.Ansi; import org.fusesource.jansi.AnsiRenderer.Code; +import jline.Terminal; + /** * Simple utitliy class to build an ANSI string when supported by the {@link Terminal}. * diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/ClearCommand.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/ClearCommand.java index 6e4f859424..69be1eb0af 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/ClearCommand.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/ClearCommand.java @@ -16,11 +16,11 @@ package org.springframework.boot.cli.command.shell; -import jline.console.ConsoleReader; - import org.springframework.boot.cli.command.AbstractCommand; import org.springframework.boot.cli.command.status.ExitStatus; +import jline.console.ConsoleReader; + /** * Clear the {@link Shell} screen. * diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/CommandCompleter.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/CommandCompleter.java index 5912dd75d2..68d690eaea 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/CommandCompleter.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/CommandCompleter.java @@ -22,6 +22,10 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.springframework.boot.cli.command.Command; +import org.springframework.boot.cli.command.options.OptionHelp; +import org.springframework.boot.cli.util.Log; + import jline.console.ConsoleReader; import jline.console.completer.AggregateCompleter; import jline.console.completer.ArgumentCompleter; @@ -30,10 +34,6 @@ import jline.console.completer.Completer; import jline.console.completer.FileNameCompleter; import jline.console.completer.StringsCompleter; -import org.springframework.boot.cli.command.Command; -import org.springframework.boot.cli.command.options.OptionHelp; -import org.springframework.boot.cli.util.Log; - /** * JLine {@link Completer} for Spring Boot {@link Command}s. * diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java index 0ee256f70f..8e84600122 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java @@ -26,9 +26,6 @@ import java.util.Map; import java.util.ServiceLoader; import java.util.Set; -import jline.console.ConsoleReader; -import jline.console.completer.CandidateListCompletionHandler; - import org.fusesource.jansi.AnsiRenderer.Code; import org.springframework.boot.cli.command.Command; import org.springframework.boot.cli.command.CommandFactory; @@ -38,6 +35,9 @@ import org.springframework.boot.cli.command.core.VersionCommand; import org.springframework.boot.loader.tools.SignalUtils; import org.springframework.util.StringUtils; +import jline.console.ConsoleReader; +import jline.console.completer.CandidateListCompletionHandler; + /** * A shell for Spring Boot. Drops the user into an event loop (REPL) where command line * completion and history are available without relying on OS shell features. diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/test/TestCommand.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/test/TestCommand.java index 34565cea1a..1a1bb24820 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/test/TestCommand.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/test/TestCommand.java @@ -16,8 +16,6 @@ package org.springframework.boot.cli.command.test; -import joptsimple.OptionSet; - import org.springframework.boot.cli.command.Command; import org.springframework.boot.cli.command.OptionParsingCommand; import org.springframework.boot.cli.command.options.CompilerOptionHandler; @@ -25,6 +23,8 @@ import org.springframework.boot.cli.command.options.OptionSetGroovyCompilerConfi import org.springframework.boot.cli.command.options.SourceOptions; import org.springframework.boot.cli.command.status.ExitStatus; +import joptsimple.OptionSet; + /** * {@link Command} to run a groovy test script or scripts. * diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/CompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/CompilerAutoConfiguration.java index 016d3721f0..47c7e3297d 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/CompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/CompilerAutoConfiguration.java @@ -16,8 +16,6 @@ package org.springframework.boot.cli.compiler; -import groovy.lang.GroovyClassLoader; - import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.classgen.GeneratorContext; import org.codehaus.groovy.control.CompilationFailedException; @@ -25,6 +23,8 @@ import org.codehaus.groovy.control.CompilePhase; import org.codehaus.groovy.control.SourceUnit; import org.codehaus.groovy.control.customizers.ImportCustomizer; +import groovy.lang.GroovyClassLoader; + /** * Strategy that can be used to apply some auto-configuration during the * {@link CompilePhase#CONVERSION} Groovy compile phase. diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyAutoConfigurationTransformation.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyAutoConfigurationTransformation.java index 678823b2b4..0905c9fbc0 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyAutoConfigurationTransformation.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyAutoConfigurationTransformation.java @@ -16,8 +16,6 @@ package org.springframework.boot.cli.compiler; -import groovy.lang.GroovyClassLoader; - import org.codehaus.groovy.ast.ASTNode; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.ast.ModuleNode; @@ -26,6 +24,8 @@ import org.codehaus.groovy.transform.ASTTransformation; import org.springframework.boot.cli.compiler.grape.DependencyResolutionContext; import org.springframework.core.annotation.Order; +import groovy.lang.GroovyClassLoader; + /** * {@link ASTTransformation} to apply * {@link CompilerAutoConfiguration#applyDependencies(DependencyCustomizer) dependency diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyCustomizer.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyCustomizer.java index b94fbf9c68..2166c82843 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyCustomizer.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyCustomizer.java @@ -16,9 +16,6 @@ package org.springframework.boot.cli.compiler; -import groovy.lang.Grab; -import groovy.lang.GroovyClassLoader; - import org.codehaus.groovy.ast.AnnotationNode; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.ast.ModuleNode; @@ -26,6 +23,9 @@ import org.codehaus.groovy.ast.expr.ConstantExpression; import org.springframework.boot.cli.compiler.dependencies.ArtifactCoordinatesResolver; import org.springframework.boot.cli.compiler.grape.DependencyResolutionContext; +import groovy.lang.Grab; +import groovy.lang.GroovyClassLoader; + /** * Customizer that allows dependencies to be added during compilation. Adding a dependency * results in a {@link Grab @Grab} annotation being added to the primary {@link ClassNode diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ExtendedGroovyClassLoader.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ExtendedGroovyClassLoader.java index 7491e0364b..3c08f060e0 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ExtendedGroovyClassLoader.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ExtendedGroovyClassLoader.java @@ -16,8 +16,6 @@ package org.springframework.boot.cli.compiler; -import groovy.lang.GroovyClassLoader; - import java.io.ByteArrayInputStream; import java.io.File; import java.io.InputStream; @@ -40,6 +38,8 @@ import org.springframework.util.Assert; import org.springframework.util.FileCopyUtils; import org.springframework.util.StringUtils; +import groovy.lang.GroovyClassLoader; + /** * Extension of the {@link GroovyClassLoader} with support for obtaining '.class' files as * resources. diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyCompiler.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyCompiler.java index 56fb792cc6..50258a9173 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyCompiler.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyCompiler.java @@ -16,10 +16,6 @@ package org.springframework.boot.cli.compiler; -import groovy.lang.GroovyClassLoader; -import groovy.lang.GroovyClassLoader.ClassCollector; -import groovy.lang.GroovyCodeSource; - import java.io.IOException; import java.lang.reflect.Field; import java.net.URL; @@ -49,6 +45,10 @@ import org.springframework.boot.cli.compiler.grape.GrapeEngineInstaller; import org.springframework.boot.cli.util.ResourceUtils; import org.springframework.core.annotation.AnnotationAwareOrderComparator; +import groovy.lang.GroovyClassLoader; +import groovy.lang.GroovyClassLoader.ClassCollector; +import groovy.lang.GroovyCodeSource; + /** * Compiler for Groovy sources. Primarily a simple Facade for * {@link GroovyClassLoader#parseClass(GroovyCodeSource)} with the following additional diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ResolveDependencyCoordinatesTransformation.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ResolveDependencyCoordinatesTransformation.java index e2a6fcd6f9..8f096757a6 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ResolveDependencyCoordinatesTransformation.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ResolveDependencyCoordinatesTransformation.java @@ -16,8 +16,6 @@ package org.springframework.boot.cli.compiler; -import groovy.lang.Grab; - import java.util.Arrays; import java.util.Collections; import java.util.HashSet; @@ -31,6 +29,8 @@ import org.codehaus.groovy.transform.ASTTransformation; import org.springframework.boot.cli.compiler.grape.DependencyResolutionContext; import org.springframework.core.annotation.Order; +import groovy.lang.Grab; + /** * {@link ASTTransformation} to resolve {@link Grab} artifact coordinates. * diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringBootCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringBootCompilerAutoConfiguration.java index 47062c8de3..fe1ddb8434 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringBootCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringBootCompilerAutoConfiguration.java @@ -16,8 +16,6 @@ package org.springframework.boot.cli.compiler.autoconfigure; -import groovy.lang.GroovyClassLoader; - import org.codehaus.groovy.ast.AnnotationNode; import org.codehaus.groovy.ast.ClassHelper; import org.codehaus.groovy.ast.ClassNode; @@ -29,6 +27,8 @@ import org.springframework.boot.cli.compiler.CompilerAutoConfiguration; import org.springframework.boot.cli.compiler.DependencyCustomizer; import org.springframework.boot.cli.compiler.GroovyCompilerConfiguration; +import groovy.lang.GroovyClassLoader; + /** * {@link CompilerAutoConfiguration} for Spring. * diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringTestCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringTestCompilerAutoConfiguration.java index c3a4fbce6a..e361a3dc6b 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringTestCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringTestCompilerAutoConfiguration.java @@ -16,8 +16,6 @@ package org.springframework.boot.cli.compiler.autoconfigure; -import groovy.lang.GroovyClassLoader; - import org.codehaus.groovy.ast.AnnotationNode; import org.codehaus.groovy.ast.ClassHelper; import org.codehaus.groovy.ast.ClassNode; @@ -31,6 +29,8 @@ import org.springframework.boot.cli.compiler.CompilerAutoConfiguration; import org.springframework.boot.cli.compiler.DependencyCustomizer; import org.springframework.boot.cli.compiler.GroovyCompilerConfiguration; +import groovy.lang.GroovyClassLoader; + /** * {@link CompilerAutoConfiguration} for Spring Test * diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/Dependency.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/Dependency.java index e4f4394f8b..a13703e24a 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/Dependency.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/Dependency.java @@ -44,7 +44,7 @@ public final class Dependency { * @param version the version */ public Dependency(String groupId, String artifactId, String version) { - this(groupId, artifactId, version, Collections. emptyList()); + this(groupId, artifactId, version, Collections.emptyList()); } /** diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngine.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngine.java index 9f9f93759c..ffc0aec76c 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngine.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngine.java @@ -16,9 +16,6 @@ package org.springframework.boot.cli.compiler.grape; -import groovy.grape.GrapeEngine; -import groovy.lang.GroovyClassLoader; - import java.io.File; import java.net.MalformedURLException; import java.net.URI; @@ -43,6 +40,9 @@ import org.eclipse.aether.resolution.DependencyResult; import org.eclipse.aether.util.artifact.JavaScopes; import org.eclipse.aether.util.filter.DependencyFilterUtils; +import groovy.grape.GrapeEngine; +import groovy.lang.GroovyClassLoader; + /** * A {@link GrapeEngine} implementation that uses Aether, the dependency resolution system used by diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngineFactory.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngineFactory.java index 6d162b7347..b9a4130dde 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngineFactory.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngineFactory.java @@ -16,8 +16,6 @@ package org.springframework.boot.cli.compiler.grape; -import groovy.lang.GroovyClassLoader; - import java.util.ArrayList; import java.util.List; import java.util.ServiceLoader; @@ -36,6 +34,8 @@ import org.eclipse.aether.spi.locator.ServiceLocator; import org.eclipse.aether.transport.file.FileTransporterFactory; import org.eclipse.aether.transport.http.HttpTransporterFactory; +import groovy.lang.GroovyClassLoader; + /** * Utility class to create a pre-configured {@link AetherGrapeEngine}. * diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/GrapeEngineInstaller.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/GrapeEngineInstaller.java index ebfb6688a7..c2c1ba5592 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/GrapeEngineInstaller.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/GrapeEngineInstaller.java @@ -16,11 +16,11 @@ package org.springframework.boot.cli.compiler.grape; +import java.lang.reflect.Field; + import groovy.grape.Grape; import groovy.grape.GrapeEngine; -import java.lang.reflect.Field; - /** * Utility to install a specific {@link Grape} engine with Groovy. * diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/groovy/GroovyTemplate.java b/spring-boot-cli/src/main/java/org/springframework/boot/groovy/GroovyTemplate.java index 2ff4d59d41..ea2f99ee2c 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/groovy/GroovyTemplate.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/groovy/GroovyTemplate.java @@ -16,11 +16,6 @@ package org.springframework.boot.groovy; -import groovy.lang.Writable; -import groovy.text.GStringTemplateEngine; -import groovy.text.Template; -import groovy.text.TemplateEngine; - import java.io.File; import java.io.IOException; import java.io.StringWriter; @@ -30,6 +25,11 @@ import java.util.Map; import org.codehaus.groovy.control.CompilationFailedException; +import groovy.lang.Writable; +import groovy.text.GStringTemplateEngine; +import groovy.text.Template; +import groovy.text.TemplateEngine; + /** * Helpful utilties for working with Groovy {@link Template}s. * @@ -39,7 +39,7 @@ public abstract class GroovyTemplate { public static String template(String name) throws IOException, CompilationFailedException, ClassNotFoundException { - return template(name, Collections. emptyMap()); + return template(name, Collections.emptyMap()); } public static String template(String name, Map model) throws IOException, diff --git a/spring-boot-cli/src/test/java/cli/command/CustomCommandFactory.java b/spring-boot-cli/src/test/java/cli/command/CustomCommandFactory.java index fa830a3a38..081d7284ce 100644 --- a/spring-boot-cli/src/test/java/cli/command/CustomCommandFactory.java +++ b/spring-boot-cli/src/test/java/cli/command/CustomCommandFactory.java @@ -29,7 +29,7 @@ public class CustomCommandFactory implements CommandFactory { @Override public Collection getCommands() { - return Collections. singleton(new CustomCommand()); + return Collections.singleton(new CustomCommand()); } } diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/CliTester.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/CliTester.java index d41dd74043..9dee88b090 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/CliTester.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/CliTester.java @@ -81,7 +81,8 @@ public class CliTester implements TestRule { try { this.commands.add(future.get(this.timeout, TimeUnit.MILLISECONDS)); return getOutput(); - } catch (Exception ex) { + } + catch (Exception ex) { return getOutput(); } } diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitCommandTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitCommandTests.java index 50062b8b95..a38458e643 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitCommandTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitCommandTests.java @@ -24,8 +24,6 @@ import java.util.UUID; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; -import joptsimple.OptionSet; - import org.apache.http.Header; import org.apache.http.client.methods.HttpUriRequest; import org.junit.Before; @@ -37,6 +35,8 @@ import org.mockito.Captor; import org.mockito.MockitoAnnotations; import org.springframework.boot.cli.command.status.ExitStatus; +import joptsimple.OptionSet; + import static org.hamcrest.Matchers.startsWith; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/ProjectGenerationRequestTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/ProjectGenerationRequestTests.java index c8dc8e46d2..d90a03ab09 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/ProjectGenerationRequestTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/ProjectGenerationRequestTests.java @@ -42,7 +42,7 @@ import static org.junit.Assert.assertEquals; public class ProjectGenerationRequestTests { public static final Map EMPTY_TAGS = Collections - . emptyMap(); + .emptyMap(); @Rule public final ExpectedException thrown = ExpectedException.none(); diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/shell/EscapeAwareWhiteSpaceArgumentDelimiterTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/shell/EscapeAwareWhiteSpaceArgumentDelimiterTests.java index 0b400c0015..d1aa0438c2 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/shell/EscapeAwareWhiteSpaceArgumentDelimiterTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/shell/EscapeAwareWhiteSpaceArgumentDelimiterTests.java @@ -16,10 +16,10 @@ package org.springframework.boot.cli.command.shell; -import jline.console.completer.ArgumentCompleter.ArgumentList; - import org.junit.Test; +import jline.console.completer.ArgumentCompleter.ArgumentList; + import static org.hamcrest.Matchers.equalTo; import static org.junit.Assert.assertThat; diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/DependencyCustomizerTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/DependencyCustomizerTests.java index 88e68d8f76..d7c880fab6 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/DependencyCustomizerTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/DependencyCustomizerTests.java @@ -16,9 +16,6 @@ package org.springframework.boot.cli.compiler; -import groovy.lang.Grab; -import groovy.lang.GroovyClassLoader; - import java.util.List; import org.codehaus.groovy.ast.AnnotationNode; @@ -33,6 +30,9 @@ import org.mockito.MockitoAnnotations; import org.springframework.boot.cli.compiler.dependencies.ArtifactCoordinatesResolver; import org.springframework.boot.cli.compiler.grape.DependencyResolutionContext; +import groovy.lang.Grab; +import groovy.lang.GroovyClassLoader; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.mockito.BDDMockito.given; diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/ResolveDependencyCoordinatesTransformationTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/ResolveDependencyCoordinatesTransformationTests.java index 06f38d65a5..8497b23f8e 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/ResolveDependencyCoordinatesTransformationTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/ResolveDependencyCoordinatesTransformationTests.java @@ -16,8 +16,6 @@ package org.springframework.boot.cli.compiler; -import groovy.lang.Grab; - import java.util.Arrays; import org.codehaus.groovy.ast.ASTNode; @@ -45,6 +43,8 @@ import org.junit.Test; import org.springframework.boot.cli.compiler.dependencies.ArtifactCoordinatesResolver; import org.springframework.boot.cli.compiler.grape.DependencyResolutionContext; +import groovy.lang.Grab; + import static org.junit.Assert.assertEquals; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; 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 d62d11eef3..93c15db073 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 @@ -16,8 +16,6 @@ package org.springframework.boot.cli.compiler.grape; -import groovy.lang.GroovyClassLoader; - import java.io.File; import java.net.URI; import java.net.URL; @@ -34,6 +32,8 @@ import org.eclipse.aether.repository.RemoteRepository; import org.junit.Test; import org.springframework.test.util.ReflectionTestUtils; +import groovy.lang.GroovyClassLoader; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; diff --git a/spring-boot-samples/spring-boot-sample-atmosphere/src/main/java/sample/atmosphere/SampleAtmosphereApplication.java b/spring-boot-samples/spring-boot-sample-atmosphere/src/main/java/sample/atmosphere/SampleAtmosphereApplication.java index c8dd14a3a7..a3b236e85f 100644 --- a/spring-boot-samples/spring-boot-sample-atmosphere/src/main/java/sample/atmosphere/SampleAtmosphereApplication.java +++ b/spring-boot-samples/spring-boot-sample-atmosphere/src/main/java/sample/atmosphere/SampleAtmosphereApplication.java @@ -72,7 +72,7 @@ public class SampleAtmosphereApplication { @Override public void onStartup(ServletContext servletContext) throws ServletException { - onStartup(Collections.> emptySet(), servletContext); + onStartup(Collections.>emptySet(), servletContext); } } diff --git a/spring-boot-samples/spring-boot-sample-testng/src/test/java/sample/testng/SampleTestNGApplicationTests.java b/spring-boot-samples/spring-boot-sample-testng/src/test/java/sample/testng/SampleTestNGApplicationTests.java index 0d179b71ba..ce180c6753 100644 --- a/spring-boot-samples/spring-boot-sample-testng/src/test/java/sample/testng/SampleTestNGApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-testng/src/test/java/sample/testng/SampleTestNGApplicationTests.java @@ -26,7 +26,6 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; import org.testng.annotations.Test; -import sample.testng.SampleTestNGApplication; import static org.testng.Assert.assertEquals; /** diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/FieldValuesParser.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/FieldValuesParser.java index aea2394384..c91d0c5fa4 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/FieldValuesParser.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/FieldValuesParser.java @@ -33,8 +33,7 @@ import org.springframework.boot.configurationprocessor.fieldvalues.javac.JavaCom public interface FieldValuesParser { /** - * Implementation of {@link FieldValuesParser} that always returns an empty - * result. + * Implementation of {@link FieldValuesParser} that always returns an empty result. */ FieldValuesParser NONE = new FieldValuesParser() { diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/lombok/LombokExplicitProperties.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/lombok/LombokExplicitProperties.java index b014016715..457a5e2de2 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/lombok/LombokExplicitProperties.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/lombok/LombokExplicitProperties.java @@ -19,11 +19,11 @@ package org.springframework.boot.configurationsample.lombok; import java.util.ArrayList; import java.util.List; +import org.springframework.boot.configurationsample.ConfigurationProperties; + import lombok.Getter; import lombok.Setter; -import org.springframework.boot.configurationsample.ConfigurationProperties; - /** * Configuration properties using lombok @Getter/@Setter at field level. * diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/lombok/LombokSimpleDataProperties.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/lombok/LombokSimpleDataProperties.java index 31000b16c5..6899811dba 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/lombok/LombokSimpleDataProperties.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/lombok/LombokSimpleDataProperties.java @@ -19,10 +19,10 @@ package org.springframework.boot.configurationsample.lombok; import java.util.ArrayList; import java.util.List; -import lombok.Data; - import org.springframework.boot.configurationsample.ConfigurationProperties; +import lombok.Data; + /** * Configuration properties using lombok @Data. * diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/lombok/LombokSimpleProperties.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/lombok/LombokSimpleProperties.java index 899a0761d8..adf01fd108 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/lombok/LombokSimpleProperties.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/lombok/LombokSimpleProperties.java @@ -19,11 +19,11 @@ package org.springframework.boot.configurationsample.lombok; import java.util.ArrayList; import java.util.List; +import org.springframework.boot.configurationsample.ConfigurationProperties; + import lombok.Getter; import lombok.Setter; -import org.springframework.boot.configurationsample.ConfigurationProperties; - /** * Configuration properties using lombok @Getter/@Setter at class level. * diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/NotAnnotated.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/NotAnnotated.java index 8346236a47..0a5d7b9e4e 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/NotAnnotated.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/NotAnnotated.java @@ -16,7 +16,6 @@ package org.springframework.boot.configurationsample.simple; - /** * This has no annotation on purpose to check that no meta-data is generated. * diff --git a/spring-boot-tools/spring-boot-dependency-tools/src/main/java/org/springframework/boot/dependency/tools/ManagedDependencies.java b/spring-boot-tools/spring-boot-dependency-tools/src/main/java/org/springframework/boot/dependency/tools/ManagedDependencies.java new file mode 100644 index 0000000000..e584147e18 --- /dev/null +++ b/spring-boot-tools/spring-boot-dependency-tools/src/main/java/org/springframework/boot/dependency/tools/ManagedDependencies.java @@ -0,0 +1,113 @@ +/* + * 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.dependency.tools; + +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; + +/** + * {@link Dependencies} used by various spring boot tools. Provides programmatic access to + * 'spring-boot-dependencies' and can also support user defined version managed + * dependencies. + * + * @author Phillip Webb + * @see Dependency + */ +public abstract class ManagedDependencies implements Dependencies { + + // NOTE: Take care if changing the API of this class, it is used by the third-party + // Gretty tool (https://github.com/akhikhl/gretty) + + private final Dependencies delegate; + + ManagedDependencies(Dependencies delegate) { + this.delegate = delegate; + } + + /** + * Return the 'spring-boot-dependencies' POM version. + * @return the version + * @deprecated since 1.1.0 in favor of {@link #getSpringBootVersion()} + */ + @Deprecated + public String getVersion() { + return getSpringBootVersion(); + } + + /** + * Return the 'spring-boot-dependencies' POM version. + * @return the spring boot version + */ + public String getSpringBootVersion() { + Dependency dependency = find("org.springframework.boot", "spring-boot"); + return (dependency == null ? null : dependency.getVersion()); + } + + /** + * Find a single dependency for the given group and artifact IDs. + * @param groupId the group ID + * @param artifactId the artifact ID + * @return a {@link Dependency} or {@code null} + */ + @Override + public Dependency find(String groupId, String artifactId) { + return this.delegate.find(groupId, artifactId); + } + + /** + * Find a single dependency for the artifact IDs. + * @param artifactId the artifact ID + * @return a {@link Dependency} or {@code null} + */ + @Override + public Dependency find(String artifactId) { + return this.delegate.find(artifactId); + } + + /** + * Provide an {@link Iterator} over all managed {@link Dependency Dependencies}. + */ + @Override + public Iterator iterator() { + return this.delegate.iterator(); + } + + /** + * Return spring-boot managed dependencies. + * @return The dependencies. + * @see #get(Collection) + */ + public static ManagedDependencies get() { + return get(Collections.emptySet()); + } + + /** + * Return spring-boot managed dependencies with optional version managed dependencies. + * @param versionManagedDependencies a collection of {@link Dependencies} that take + * precedence over the {@literal spring-boot-dependencies}. + * @return the dependencies + * @since 1.1.0 + */ + public static ManagedDependencies get( + Collection versionManagedDependencies) { + return new ManagedDependencies(new ManagedDependenciesDelegate( + versionManagedDependencies)) { + }; + } + +} diff --git a/spring-boot-tools/spring-boot-dependency-tools/src/test/java/org/springframework/boot/dependency/tools/ManagedDependenciesDelegateTests.java b/spring-boot-tools/spring-boot-dependency-tools/src/test/java/org/springframework/boot/dependency/tools/ManagedDependenciesDelegateTests.java new file mode 100644 index 0000000000..7cf95485c5 --- /dev/null +++ b/spring-boot-tools/spring-boot-dependency-tools/src/test/java/org/springframework/boot/dependency/tools/ManagedDependenciesDelegateTests.java @@ -0,0 +1,70 @@ +/* + * 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.dependency.tools; + +import java.util.Collections; +import java.util.Iterator; + +import org.junit.Before; +import org.junit.Test; + +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertThat; + +/** + * Tests for {@link ManagedDependenciesDelegate}. + * + * @author Phillip Webb + */ +public class ManagedDependenciesDelegateTests { + + private ManagedDependenciesDelegate dependencies; + + @Before + public void setup() throws Exception { + PropertiesFileDependencies root = new PropertiesFileDependencies(getClass() + .getResourceAsStream("external.properties")); + PropertiesFileDependencies extra = new PropertiesFileDependencies(getClass() + .getResourceAsStream("additional-external.properties")); + this.dependencies = new ManagedDependenciesDelegate(root, + Collections.singleton(extra)); + } + + @Test + public void extra() throws Exception { + assertThat(this.dependencies.find("org.sample", "sample03").toString(), + equalTo("org.sample:sample03:2.0.0")); + } + + @Test + public void override() throws Exception { + assertThat(this.dependencies.find("org.sample", "sample02").toString(), + equalTo("org.sample:sample02:2.0.0")); + } + + @Test + public void iterator() throws Exception { + Iterator iterator = this.dependencies.iterator(); + assertThat(iterator.next().toString(), equalTo("org.sample:sample01:1.0.0")); + assertThat(iterator.next().toString(), equalTo("org.sample:sample02:2.0.0")); + assertThat(iterator.next().toString(), + equalTo("org.springframework.boot:spring-boot:1.0.0.BUILD-SNAPSHOT")); + assertThat(iterator.next().toString(), equalTo("org.sample:sample03:2.0.0")); + assertThat(iterator.hasNext(), equalTo(false)); + } + +} diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/PropertiesLauncherTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/PropertiesLauncherTests.java index a7bde9b17f..917c4bbc8f 100644 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/PropertiesLauncherTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/PropertiesLauncherTests.java @@ -149,8 +149,7 @@ public class PropertiesLauncherTests { public void testCustomClassLoaderCreation() throws Exception { System.setProperty("loader.classLoader", TestLoader.class.getName()); PropertiesLauncher launcher = new PropertiesLauncher(); - ClassLoader loader = launcher - .createClassLoader(Collections. emptyList()); + ClassLoader loader = launcher.createClassLoader(Collections.emptyList()); assertNotNull(loader); assertEquals(TestLoader.class.getName(), loader.getClass().getName()); } diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/DependencyFilterMojoTests.java b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/DependencyFilterMojoTests.java index 1db573c2cb..1f37f240fa 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/DependencyFilterMojoTests.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/DependencyFilterMojoTests.java @@ -42,7 +42,7 @@ public class DependencyFilterMojoTests { @Test public void filterDependencies() throws MojoExecutionException { TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo( - Collections. emptyList(), "com.foo", "exclude-id"); + Collections.emptyList(), "com.foo", "exclude-id"); Artifact artifact = createArtifact("com.bar", "one"); Set artifacts = mojo.filterDependencies( @@ -55,7 +55,7 @@ public class DependencyFilterMojoTests { @Test public void filterGroupIdExactMatch() throws MojoExecutionException { TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo( - Collections. emptyList(), "com.foo", ""); + Collections.emptyList(), "com.foo", ""); Artifact artifact = createArtifact("com.foo.bar", "one"); Set artifacts = mojo.filterDependencies( diff --git a/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java b/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java index 9fcc43f52a..0c9a9fe02d 100644 --- a/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java +++ b/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java @@ -16,8 +16,6 @@ package org.springframework.boot; -import groovy.lang.Closure; - import java.io.IOException; import java.util.HashSet; import java.util.Set; @@ -43,6 +41,8 @@ import org.springframework.util.Assert; import org.springframework.util.ClassUtils; import org.springframework.util.StringUtils; +import groovy.lang.Closure; + /** * Loads bean definitions from underlying sources, including XML and JavaConfig. Acts as a * simple facade over {@link AnnotatedBeanDefinitionReader}, diff --git a/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessor.java b/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessor.java index 9be8e633ab..f96c3309cc 100644 --- a/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessor.java +++ b/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessor.java @@ -101,7 +101,7 @@ public class AtomikosDependsOnBeanFactoryPostProcessor implements } private List asList(String[] array) { - return (array == null ? Collections. emptyList() : Arrays.asList(array)); + return (array == null ? Collections.emptyList() : Arrays.asList(array)); } @Override diff --git a/spring-boot/src/main/java/org/springframework/boot/liquibase/CommonsLoggingLiquibaseLogger.java b/spring-boot/src/main/java/org/springframework/boot/liquibase/CommonsLoggingLiquibaseLogger.java index 0655f2783b..f86782380c 100644 --- a/spring-boot/src/main/java/org/springframework/boot/liquibase/CommonsLoggingLiquibaseLogger.java +++ b/spring-boot/src/main/java/org/springframework/boot/liquibase/CommonsLoggingLiquibaseLogger.java @@ -16,13 +16,13 @@ package org.springframework.boot.liquibase; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import liquibase.logging.LogLevel; import liquibase.logging.Logger; import liquibase.logging.core.AbstractLogger; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - /** * Liquibase {@link Logger} that delegates to an Apache Commons {@link Log}. * diff --git a/spring-boot/src/main/java/org/springframework/boot/liquibase/LiquibaseServiceLocatorApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/liquibase/LiquibaseServiceLocatorApplicationListener.java index 47ee4784a0..1d28157fc5 100644 --- a/spring-boot/src/main/java/org/springframework/boot/liquibase/LiquibaseServiceLocatorApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/liquibase/LiquibaseServiceLocatorApplicationListener.java @@ -16,15 +16,15 @@ package org.springframework.boot.liquibase; -import liquibase.servicelocator.CustomResolverServiceLocator; -import liquibase.servicelocator.ServiceLocator; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.boot.context.event.ApplicationStartedEvent; import org.springframework.context.ApplicationListener; import org.springframework.util.ClassUtils; +import liquibase.servicelocator.CustomResolverServiceLocator; +import liquibase.servicelocator.ServiceLocator; + /** * {@link ApplicationListener} that replaces the liquibase {@link ServiceLocator} with a * version that works with Spring Boot executable archives. diff --git a/spring-boot/src/main/java/org/springframework/boot/liquibase/SpringPackageScanClassResolver.java b/spring-boot/src/main/java/org/springframework/boot/liquibase/SpringPackageScanClassResolver.java index d8db8764a9..f66a5f2c59 100644 --- a/spring-boot/src/main/java/org/springframework/boot/liquibase/SpringPackageScanClassResolver.java +++ b/spring-boot/src/main/java/org/springframework/boot/liquibase/SpringPackageScanClassResolver.java @@ -18,9 +18,6 @@ package org.springframework.boot.liquibase; import java.io.IOException; -import liquibase.servicelocator.DefaultPackageScanClassResolver; -import liquibase.servicelocator.PackageScanClassResolver; - import org.apache.commons.logging.Log; import org.springframework.core.io.Resource; import org.springframework.core.io.support.PathMatchingResourcePatternResolver; @@ -30,6 +27,9 @@ import org.springframework.core.type.classreading.MetadataReader; import org.springframework.core.type.classreading.MetadataReaderFactory; import org.springframework.util.ClassUtils; +import liquibase.servicelocator.DefaultPackageScanClassResolver; +import liquibase.servicelocator.PackageScanClassResolver; + /** * Liquibase {@link PackageScanClassResolver} implementation that uses Spring's resource * scanning to locate classes. This variant is safe to use with Spring Boot packaged diff --git a/spring-boot/src/main/java/org/springframework/boot/test/TestRestTemplate.java b/spring-boot/src/main/java/org/springframework/boot/test/TestRestTemplate.java index cf0e3547a3..6f22aae929 100644 --- a/spring-boot/src/main/java/org/springframework/boot/test/TestRestTemplate.java +++ b/spring-boot/src/main/java/org/springframework/boot/test/TestRestTemplate.java @@ -85,7 +85,7 @@ public class TestRestTemplate extends RestTemplate { return; } List interceptors = Collections - . singletonList(new BasicAuthorizationInterceptor( + .singletonList(new BasicAuthorizationInterceptor( username, password)); setRequestFactory(new InterceptingClientHttpRequestFactory(getRequestFactory(), interceptors)); diff --git a/spring-boot/src/test/java/org/springframework/boot/ResourceBannerTests.java b/spring-boot/src/test/java/org/springframework/boot/ResourceBannerTests.java index 2b5b1e8ff9..6e4d5b7962 100644 --- a/spring-boot/src/test/java/org/springframework/boot/ResourceBannerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/ResourceBannerTests.java @@ -103,7 +103,7 @@ public class ResourceBannerTests { ResourceBanner banner = new MockResourceBanner(resource, bootVersion, applicationVersion); ConfigurableEnvironment environment = new MockEnvironment(); - Map source = Collections. singletonMap("a", "1"); + Map source = Collections.singletonMap("a", "1"); environment.getPropertySources().addLast(new MapPropertySource("map", source)); ByteArrayOutputStream out = new ByteArrayOutputStream(); banner.printBanner(environment, getClass(), new PrintStream(out)); diff --git a/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java b/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java index 4c35b12802..73701c4950 100644 --- a/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java @@ -363,7 +363,7 @@ public class SpringApplicationTests { ConfigurableEnvironment environment = new StandardEnvironment(); environment.getPropertySources().addFirst( new MapPropertySource("commandLineArgs", Collections - . singletonMap("foo", "original"))); + .singletonMap("foo", "original"))); application.setEnvironment(environment); application.run("--foo=bar", "--bar=foo"); assertTrue(hasPropertySource(environment, CompositePropertySource.class, diff --git a/spring-boot/src/test/java/org/springframework/boot/bind/PropertySourcesPropertyValuesTests.java b/spring-boot/src/test/java/org/springframework/boot/bind/PropertySourcesPropertyValuesTests.java index 458ca9732e..2cf79477cd 100644 --- a/spring-boot/src/test/java/org/springframework/boot/bind/PropertySourcesPropertyValuesTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/bind/PropertySourcesPropertyValuesTests.java @@ -56,12 +56,12 @@ public class PropertySourcesPropertyValuesTests { }); this.propertySources.addFirst(new MapPropertySource("map", Collections - . singletonMap("name", "${foo}"))); + .singletonMap("name", "${foo}"))); } @Test public void testTypesPreserved() { - Map map = Collections. singletonMap("name", 123); + Map map = Collections.singletonMap("name", 123); this.propertySources.replace("map", new MapPropertySource("map", map)); PropertySourcesPropertyValues propertyValues = new PropertySourcesPropertyValues( this.propertySources); @@ -142,7 +142,7 @@ public class PropertySourcesPropertyValuesTests { @Test public void testOverriddenValue() { this.propertySources.addFirst(new MapPropertySource("new", Collections - . singletonMap("name", "spam"))); + .singletonMap("name", "spam"))); PropertySourcesPropertyValues propertyValues = new PropertySourcesPropertyValues( this.propertySources); assertEquals("spam", propertyValues.getPropertyValue("name").getValue()); @@ -170,7 +170,7 @@ public class PropertySourcesPropertyValuesTests { TestBean target = new TestBean(); DataBinder binder = new DataBinder(target); this.propertySources.addFirst(new MapPropertySource("another", Collections - . singletonMap("something", "${nonexistent}"))); + .singletonMap("something", "${nonexistent}"))); binder.bind(new PropertySourcesPropertyValues(this.propertySources)); assertEquals("bar", target.getName()); } diff --git a/spring-boot/src/test/java/org/springframework/boot/builder/SpringApplicationBuilderTests.java b/spring-boot/src/test/java/org/springframework/boot/builder/SpringApplicationBuilderTests.java index e0429330e2..d33357f14a 100644 --- a/spring-boot/src/test/java/org/springframework/boot/builder/SpringApplicationBuilderTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/builder/SpringApplicationBuilderTests.java @@ -75,7 +75,7 @@ public class SpringApplicationBuilderTests { SpringApplicationBuilder application = new SpringApplicationBuilder() .sources(ExampleConfig.class) .contextClass(StaticApplicationContext.class) - .properties(Collections. singletonMap("bar", "foo")); + .properties(Collections.singletonMap("bar", "foo")); this.context = application.run(); assertThat(this.context.getEnvironment().getProperty("bar"), is(equalTo("foo"))); } diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/MockEmbeddedServletContainerFactory.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/MockEmbeddedServletContainerFactory.java index dec57b2567..3309e7a1c1 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/MockEmbeddedServletContainerFactory.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/MockEmbeddedServletContainerFactory.java @@ -149,7 +149,7 @@ public class MockEmbeddedServletContainerFactory extends } }); given(this.servletContext.getAttributeNames()).willReturn( - MockEmbeddedServletContainer. emptyEnumeration()); + MockEmbeddedServletContainer.emptyEnumeration()); given(this.servletContext.getNamedDispatcher("default")).willReturn( mock(RequestDispatcher.class)); for (ServletContextInitializer initializer : this.initializers) { diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactoryTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactoryTests.java index 959ca7d3fd..7d673e85cd 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactoryTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactoryTests.java @@ -16,9 +16,6 @@ package org.springframework.boot.context.embedded.undertow; -import io.undertow.Undertow.Builder; -import io.undertow.servlet.api.DeploymentInfo; - import java.util.Arrays; import java.util.concurrent.atomic.AtomicReference; @@ -31,6 +28,9 @@ import org.springframework.boot.context.embedded.ExampleServlet; import org.springframework.boot.context.embedded.ServletRegistrationBean; import org.springframework.http.HttpStatus; +import io.undertow.Undertow.Builder; +import io.undertow.servlet.api.DeploymentInfo; + import static org.hamcrest.Matchers.equalTo; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; diff --git a/spring-boot/src/test/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesTests.java b/spring-boot/src/test/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesTests.java index 812f5102ad..a7e2f7ab79 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesTests.java @@ -157,7 +157,7 @@ public class EnableConfigurationPropertiesTests { public void testExceptionOnValidation() { this.context.register(ExceptionIfInvalidTestConfiguration.class); EnvironmentTestUtils.addEnvironment(this.context, "name:foo"); - this.expected.expectCause(Matchers. instanceOf(BindException.class)); + this.expected.expectCause(Matchers.instanceOf(BindException.class)); this.context.refresh(); } diff --git a/spring-boot/src/test/java/org/springframework/boot/liquibase/CommonsLoggingLiquibaseLoggerTests.java b/spring-boot/src/test/java/org/springframework/boot/liquibase/CommonsLoggingLiquibaseLoggerTests.java index bc573fd165..8add298a7e 100644 --- a/spring-boot/src/test/java/org/springframework/boot/liquibase/CommonsLoggingLiquibaseLoggerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/liquibase/CommonsLoggingLiquibaseLoggerTests.java @@ -16,12 +16,12 @@ package org.springframework.boot.liquibase; -import liquibase.logging.LogLevel; - import org.apache.commons.logging.Log; import org.junit.Before; import org.junit.Test; +import liquibase.logging.LogLevel; + import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; diff --git a/spring-boot/src/test/java/org/springframework/boot/liquibase/LiquibaseServiceLocatorApplicationListenerTests.java b/spring-boot/src/test/java/org/springframework/boot/liquibase/LiquibaseServiceLocatorApplicationListenerTests.java index e3806a387d..a75a5a57e9 100644 --- a/spring-boot/src/test/java/org/springframework/boot/liquibase/LiquibaseServiceLocatorApplicationListenerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/liquibase/LiquibaseServiceLocatorApplicationListenerTests.java @@ -18,13 +18,13 @@ package org.springframework.boot.liquibase; import java.lang.reflect.Field; -import liquibase.servicelocator.ServiceLocator; - import org.junit.Test; import org.springframework.boot.SpringApplication; import org.springframework.context.annotation.Configuration; import org.springframework.util.ReflectionUtils; +import liquibase.servicelocator.ServiceLocator; + import static org.hamcrest.Matchers.instanceOf; import static org.junit.Assert.assertThat; diff --git a/spring-boot/src/test/java/org/springframework/boot/liquibase/SpringPackageScanClassResolverTests.java b/spring-boot/src/test/java/org/springframework/boot/liquibase/SpringPackageScanClassResolverTests.java index 129239091d..d5984a3af3 100644 --- a/spring-boot/src/test/java/org/springframework/boot/liquibase/SpringPackageScanClassResolverTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/liquibase/SpringPackageScanClassResolverTests.java @@ -18,11 +18,11 @@ package org.springframework.boot.liquibase; import java.util.Set; -import liquibase.logging.Logger; - import org.apache.commons.logging.LogFactory; import org.junit.Test; +import liquibase.logging.Logger; + import static org.hamcrest.Matchers.greaterThan; import static org.junit.Assert.assertThat;