From cf655945aa4a795453273e5b09d6649d26f3ab49 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Thu, 8 Aug 2013 21:49:38 -0700 Subject: [PATCH] Polish --- .../actuate/audit/AuditEventRepository.java | 2 - ...dpointWebMvcChildContextConfiguration.java | 5 -- .../SecurityAutoConfiguration.java | 4 -- .../actuate/metrics/DefaultGaugeService.java | 1 + .../metrics/InMemoryMetricRepository.java | 3 +- .../actuate/metrics/MetricRepository.java | 6 -- .../boot/actuate/web/ErrorController.java | 3 + .../fixme/ErrorConfigurationTests.java | 39 ------------- .../autoconfigure/AutoConfigureAfter.java | 5 ++ .../autoconfigure/AutoConfigureBefore.java | 5 ++ .../batch/BatchAutoConfiguration.java | 1 - .../condition/SearchStrategy.java | 2 + .../jdbc/AbstractDataSourceConfiguration.java | 2 - .../jdbc/DataSourceAutoConfiguration.java | 1 - .../jpa/HibernateJpaAutoConfiguration.java | 1 - .../reactor/ReactorAutoConfiguration.java | 5 +- .../thymeleaf/ThymeleafAutoConfiguration.java | 2 +- .../boot/cli/command/CreateCommand.java | 57 ------------------- .../boot/cli/command/RunCommand.java | 2 - .../SpringMvcCompilerAutoConfiguration.java | 6 -- .../cli/runner/SpringApplicationRunner.java | 2 - .../boot/cli/template/GroovyTemplate.java | 2 - .../sample/ui/MessageControllerWebTests.java | 3 +- .../boot/loader/tools/Repackager.java | 4 +- .../boot/loader/LaunchedURLClassLoader.java | 1 - .../boot/loader/data/RandomAccessData.java | 1 - .../boot/loader/ExplodedArchiveTests.java | 4 +- .../loader/jar/RandomAccessJarFileTests.java | 4 +- .../ServletListenerRegistrationBean.java | 4 +- .../boot/OverrideSourcesTests.java | 3 + .../boot/bind/BindingPreparationTests.java | 1 - .../PropertySourcesPropertyValuesTests.java | 2 +- .../boot/config/JacksonParserTests.java | 3 - .../boot/config/YamlJsonParserTests.java | 4 -- .../boot/config/YamlProcessorTests.java | 4 +- .../YamlPropertiesFactoryBeanTests.java | 2 - .../ServletListenerRegistrationBeanTests.java | 10 ++++ 37 files changed, 49 insertions(+), 157 deletions(-) delete mode 100644 spring-boot-actuator/src/test/java/org/springframework/boot/actuate/fixme/ErrorConfigurationTests.java delete mode 100644 spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CreateCommand.java diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEventRepository.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEventRepository.java index d85a92164d..225a454d0b 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEventRepository.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEventRepository.java @@ -28,7 +28,6 @@ public interface AuditEventRepository { /** * Find audit events relating to the specified principal since the time provided. - * * @param principal the principal name to search for * @param after timestamp of earliest result required * @return audit events relating to the principal @@ -37,7 +36,6 @@ public interface AuditEventRepository { /** * Log an event. - * * @param event the audit event to log */ void add(AuditEvent event); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java index 463b2ef2a8..ef6ccc41a8 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java @@ -55,7 +55,6 @@ public class EndpointWebMvcChildContextConfiguration implements factory.setPort(this.managementServerProperties.getPort()); factory.setAddress(this.managementServerProperties.getAddress()); factory.setContextPath(this.managementServerProperties.getContextPath()); - // TODO: Disable sessions } @Bean @@ -86,10 +85,6 @@ public class EndpointWebMvcChildContextConfiguration implements @ConditionalOnBean(name = "springSecurityFilterChain", search = SearchStrategy.PARENTS) public static class EndpointWebMvcChildContextSecurityConfiguration { - // FIXME reuse of security filter here is not good. What if totally different - // security config is required. Perhaps we can just drop it on the management - // port? - @Bean public Filter springSecurityFilterChain(HierarchicalBeanFactory beanFactory) { BeanFactory parent = beanFactory.getParentBeanFactory(); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/SecurityAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/SecurityAutoConfiguration.java index 1f2ef7ba5d..a392327d0b 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/SecurityAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/SecurityAutoConfiguration.java @@ -152,7 +152,6 @@ public class SecurityAutoConfiguration { list.add(path); } } - // FIXME makes more sense to secure endpoints with a different role list.addAll(Arrays.asList(getEndpointPaths(true))); return list.toArray(new String[list.size()]); } @@ -178,9 +177,6 @@ public class SecurityAutoConfiguration { return NO_PATHS; } - // FIXME this will still open up paths on the server when a management port is - // being used. - List> endpoints = this.endpointHandlerMapping.getEndpoints(); List paths = new ArrayList(endpoints.size()); for (Endpoint endpoint : endpoints) { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/DefaultGaugeService.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/DefaultGaugeService.java index 299f0dcadf..9e94ca1ff7 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/DefaultGaugeService.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/DefaultGaugeService.java @@ -28,6 +28,7 @@ public class DefaultGaugeService implements GaugeService { private MetricRepository metricRepository; /** + * Create a new {@link DefaultGaugeService} instance. * @param counterRepository */ public DefaultGaugeService(MetricRepository counterRepository) { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/InMemoryMetricRepository.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/InMemoryMetricRepository.java index 99f35b7aec..1adaf2a8c5 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/InMemoryMetricRepository.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/InMemoryMetricRepository.java @@ -23,6 +23,8 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; /** + * {@link MetricRepository} implementation that stores metric in-memory. + * * @author Dave Syer */ public class InMemoryMetricRepository implements MetricRepository { @@ -31,7 +33,6 @@ public class InMemoryMetricRepository implements MetricRepository { @Override public void increment(String metricName, int amount, Date timestamp) { - // FIXME this might not be thread safe Measurement current = this.metrics.get(metricName); if (current != null) { Metric metric = current.getMetric(); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/MetricRepository.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/MetricRepository.java index 77ac665cf4..b03e01af11 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/MetricRepository.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/MetricRepository.java @@ -26,12 +26,6 @@ import java.util.Date; */ public interface MetricRepository { - // FIXME perhaps revisit this, there is no way to get timestamps - // could also simply, leaving increment to counter service - - // Perhaps findAll, findOne should return Measurements - // put(String name, Callback -> process(Metric) - void increment(String metricName, int amount, Date timestamp); void set(String metricName, double value, Date timestamp); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/ErrorController.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/ErrorController.java index 3166c9597b..8e638bbcbf 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/ErrorController.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/ErrorController.java @@ -26,6 +26,9 @@ import org.springframework.stereotype.Controller; */ public interface ErrorController { + /** + * Returns the path of the error page. + */ public String getErrorPath(); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/fixme/ErrorConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/fixme/ErrorConfigurationTests.java deleted file mode 100644 index 4025f3380f..0000000000 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/fixme/ErrorConfigurationTests.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.actuate.fixme; - -/** - * @author Dave Syer - */ -public class ErrorConfigurationTests { - - // private AnnotationConfigApplicationContext context; - // - // @Test - // public void testErrorEndpointConfiguration() throws Exception { - // this.context = new AnnotationConfigApplicationContext(); - // this.context.register(ErrorConfiguration.class, - // ActuatorServerPropertiesConfiguration.class, - // PropertyPlaceholderAutoConfiguration.class); - // this.context.refresh(); - // assertNotNull(this.context.getBean(ErrorEndpoint.class)); - // ConfigurableEmbeddedServletContainerFactory factory = Mockito - // .mock(ConfigurableEmbeddedServletContainerFactory.class); - // this.context.getBean(EmbeddedServletContainerCustomizer.class).customize(factory); - // Mockito.verify(factory).addErrorPages(Mockito.any(ErrorPage.class)); - // } -} diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigureAfter.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigureAfter.java index 14a8acee49..9c8682eef1 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigureAfter.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigureAfter.java @@ -30,5 +30,10 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target({ ElementType.TYPE }) public @interface AutoConfigureAfter { + + /** + * The auto-configure classes that should have already been applied. + */ Class[] value(); + } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigureBefore.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigureBefore.java index d961530905..56ec9c5dd0 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigureBefore.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigureBefore.java @@ -30,5 +30,10 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target({ ElementType.TYPE }) public @interface AutoConfigureBefore { + + /** + * The auto-configure classes that should have not yet been applied. + */ Class[] value(); + } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfiguration.java index bbf88ca17f..8beecd002a 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfiguration.java @@ -36,7 +36,6 @@ import org.springframework.context.annotation.Configuration; public class BatchAutoConfiguration { @Bean - // Harmless to always include this, but maybe could make it conditional as well public BatchDatabaseInitializer batchDatabaseInitializer() { return new BatchDatabaseInitializer(); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/SearchStrategy.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/SearchStrategy.java index aeefe485a8..2e697c319d 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/SearchStrategy.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/SearchStrategy.java @@ -27,10 +27,12 @@ public enum SearchStrategy { * Search only the current context */ CURRENT, + /** * Search all parents and ancestors, but not the current context */ PARENTS, + /** * Search the entire hierarchy * diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/AbstractDataSourceConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/AbstractDataSourceConfiguration.java index d4dced0746..9b243f487e 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/AbstractDataSourceConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/AbstractDataSourceConfiguration.java @@ -28,8 +28,6 @@ import org.springframework.util.StringUtils; */ public class AbstractDataSourceConfiguration { - // TODO: add pool parameters - @Value("${spring.database.driverClassName:}") private String driverClassName; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java index a5288ddf1a..da51f31396 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java @@ -86,7 +86,6 @@ public class DataSourceAutoConfiguration { @Configuration @Conditional(DataSourceAutoConfiguration.SomeDatabaseCondition.class) - // FIXME: make this @ConditionalOnBean(DataSource.class) protected static class JdbcTemplateConfiguration { @Autowired(required = false) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java index 1f33e2f1a4..10f6c4f94a 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java @@ -78,7 +78,6 @@ public class HibernateJpaAutoConfiguration extends JpaBaseConfiguration { protected void configure( LocalContainerEntityManagerFactoryBean entityManagerFactoryBean) { Map properties = entityManagerFactoryBean.getJpaPropertyMap(); - // FIXME: detect EhCache properties.put("hibernate.cache.provider_class", "org.hibernate.cache.HashtableCacheProvider"); if (StringUtils.hasLength(this.ddlAuto) && !"none".equals(this.ddlAuto)) { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/reactor/ReactorAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/reactor/ReactorAutoConfiguration.java index 0fc2ee9442..3e0cdf27e4 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/reactor/ReactorAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/reactor/ReactorAutoConfiguration.java @@ -17,6 +17,7 @@ package org.springframework.boot.autoconfigure.reactor; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration; @@ -30,6 +31,8 @@ import reactor.core.Reactor; import reactor.spring.context.ConsumerBeanPostProcessor; /** + * {@link EnableAutoConfiguration Auto-configuration} for Reactor. + * * @author Dave Syer */ @Configuration @@ -40,7 +43,7 @@ public class ReactorAutoConfiguration { @Bean public Environment reactorEnvironment() { - return new Environment(); // TODO: use Spring Environment to configure? + return new Environment(); } @Bean 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 0dee625c5e..2e2225f8fc 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 @@ -46,7 +46,7 @@ import org.thymeleaf.templateresolver.ITemplateResolver; import org.thymeleaf.templateresolver.TemplateResolver; /** - * {@link EnableAutoConfiguration Auto-configuration} for Thymeleaf templating. + * {@link EnableAutoConfiguration Auto-configuration} for Thymeleaf. * * @author Dave Syer */ diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CreateCommand.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CreateCommand.java deleted file mode 100644 index bb1d67abd7..0000000000 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CreateCommand.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.cli.command; - -import joptsimple.OptionSet; - -import org.springframework.boot.cli.Command; - -import static java.util.Arrays.asList; - -/** - * {@link Command} to 'create' a new spring groovy script. - * - * @author Phillip Webb - */ -public class CreateCommand extends OptionParsingCommand { - - public CreateCommand() { - super("create", "Create an new spring groovy script", new CreateOptionHandler()); - } - - @Override - public String getUsageHelp() { - return "[options] "; - } - - private static class CreateOptionHandler extends OptionHandler { - - @Override - protected void options() { - option(asList("overwite", "f"), "Overwrite any existing file"); - option("type", "Create a specific application type").withOptionalArg() - .ofType(String.class).describedAs("web, batch, integration"); - } - - @Override - protected void run(OptionSet options) { - throw new IllegalStateException("Not implemented"); // FIXME - } - - } - -} diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/RunCommand.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/RunCommand.java index 4bf123b745..e167f6b346 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/RunCommand.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/RunCommand.java @@ -121,8 +121,6 @@ public class RunCommand extends OptionParsingCommand { if ("--".equals(filename)) { break; } - // TODO: add support for strict Java compilation - // TODO: add support for recursive search in directory if (filename.endsWith(".groovy") || filename.endsWith(".java")) { File file = new File(filename); if (file.isFile() && file.canRead()) { diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java index d750dde415..9862662727 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java @@ -43,12 +43,6 @@ public class SpringMvcCompilerAutoConfiguration extends CompilerAutoConfiguratio dependencies.add("org.codehaus.groovy", "groovy-templates", dependencies.getProperty("groovy.version")); - // FIXME restore Tomcat when we can get reload to work - // dependencies.ifMissingClasses("org.apache.catalina.startup.Tomcat") - // .add("org.apache.tomcat.embed", "tomcat-embed-core", - // dependencies.getProperty("tomcat.version")) - // .add("org.apache.tomcat.embed", "tomcat-embed-logging-juli", - // dependencies.getProperty("tomcat.version")); } @Override diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/runner/SpringApplicationRunner.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/runner/SpringApplicationRunner.java index 074d2f8484..238a4919f9 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/runner/SpringApplicationRunner.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/runner/SpringApplicationRunner.java @@ -37,8 +37,6 @@ public class SpringApplicationRunner { private static int runnerCounter = 0; - // FIXME logging - private SpringApplicationRunnerConfiguration configuration; private final File[] files; diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/template/GroovyTemplate.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/template/GroovyTemplate.java index c21ef53c32..a253497922 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/template/GroovyTemplate.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/template/GroovyTemplate.java @@ -32,8 +32,6 @@ import org.codehaus.groovy.control.CompilationFailedException; */ public abstract class GroovyTemplate { - // FIXME is this used? - public static String template(String name) throws IOException, CompilationFailedException, ClassNotFoundException { return template(name, Collections. emptyMap()); diff --git a/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/org/springframework/boot/sample/ui/MessageControllerWebTests.java b/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/org/springframework/boot/sample/ui/MessageControllerWebTests.java index ce2c57748b..e4b659d511 100644 --- a/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/org/springframework/boot/sample/ui/MessageControllerWebTests.java +++ b/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/org/springframework/boot/sample/ui/MessageControllerWebTests.java @@ -24,13 +24,14 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. /** * A Basic Spring MVC Test for the Sample Controller" - * + * * @author Biju Kunjummen */ @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration @ContextConfiguration(classes = SampleWebUiApplication.class) public class MessageControllerWebTests { + @Autowired private WebApplicationContext wac; diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java index 6cbaa91e38..9914588b66 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java @@ -88,8 +88,8 @@ public class Repackager { } /** - * Repackage to the given destination so that it can be run using '{@literal java -jar} - * ' + * Repackage to the given destination so that it can be launched using ' + * {@literal java -jar}' * @param destination the destination file (may be the same as the source) * @param libraries the libraries required to run the archive * @throws IOException diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/LaunchedURLClassLoader.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/LaunchedURLClassLoader.java index bae9a6f43b..19b2173519 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/LaunchedURLClassLoader.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/LaunchedURLClassLoader.java @@ -60,7 +60,6 @@ public class LaunchedURLClassLoader extends URLClassLoader { /** * Define a package before a {@code findClass} call is made. This is necessary to * ensure that the appropriate manifest for nested JARs associated with the package. - * * @param name the class name being found * @param packageName the pacakge */ diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/data/RandomAccessData.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/data/RandomAccessData.java index 2e05d07069..c4fe2365af 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/data/RandomAccessData.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/data/RandomAccessData.java @@ -29,7 +29,6 @@ public interface RandomAccessData { /** * Returns an {@link InputStream} that can be used to read the underling data. The * caller is responsible close the underlying stream. - * * @return a new input stream that can be used to read the underlying data. */ InputStream getInputStream(); diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/ExplodedArchiveTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/ExplodedArchiveTests.java index a8512aae6d..3412cb5de4 100644 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/ExplodedArchiveTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/ExplodedArchiveTests.java @@ -33,8 +33,6 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import org.springframework.boot.loader.Archive; -import org.springframework.boot.loader.ExplodedArchive; import org.springframework.boot.loader.Archive.Entry; import static org.hamcrest.Matchers.equalTo; @@ -76,6 +74,7 @@ public class ExplodedArchiveTests { } } this.archive = new ExplodedArchive(this.rootFolder); + jarFile.close(); } private void copy(InputStream in, OutputStream out) throws IOException { @@ -141,6 +140,7 @@ public class ExplodedArchiveTests { new URL[] { filteredArchive.getUrl() }); assertThat(classLoader.getResourceAsStream("1.dat").read(), equalTo(1)); assertThat(classLoader.getResourceAsStream("2.dat"), nullValue()); + classLoader.close(); } private Map getEntriesMap(Archive archive) { diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/RandomAccessJarFileTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/RandomAccessJarFileTests.java index 5e84bf454c..53fc06a576 100644 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/RandomAccessJarFileTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/RandomAccessJarFileTests.java @@ -34,8 +34,6 @@ import org.junit.rules.ExpectedException; import org.junit.rules.TemporaryFolder; import org.springframework.boot.loader.TestJarCreator; import org.springframework.boot.loader.data.RandomAccessDataFile; -import org.springframework.boot.loader.jar.JarEntryFilter; -import org.springframework.boot.loader.jar.RandomAccessJarFile; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThan; @@ -75,6 +73,7 @@ public class RandomAccessJarFileTests { public void createFromFile() throws Exception { RandomAccessJarFile jarFile = new RandomAccessJarFile(this.rootJarFile); assertThat(jarFile.getName(), notNullValue(String.class)); + jarFile.close(); } @Test @@ -83,6 +82,7 @@ public class RandomAccessJarFileTests { this.rootJarFile, 1); RandomAccessJarFile jarFile = new RandomAccessJarFile(randomAccessDataFile); assertThat(jarFile.getName(), notNullValue(String.class)); + jarFile.close(); } @Test diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/ServletListenerRegistrationBean.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/ServletListenerRegistrationBean.java index 066b7001e7..36442e7edf 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/ServletListenerRegistrationBean.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/ServletListenerRegistrationBean.java @@ -81,7 +81,7 @@ public class ServletListenerRegistrationBean extends */ public ServletListenerRegistrationBean(T listener) { Assert.notNull(listener, "Listener must not be null"); - Assert.isTrue(isSupportedType(listener), "EventLisener is not a supported type"); + Assert.isTrue(isSupportedType(listener), "Listener is not of a supported type"); this.listener = listener; } @@ -91,7 +91,7 @@ public class ServletListenerRegistrationBean extends */ public void setListener(T listener) { Assert.notNull(listener, "Listener must not be null"); - Assert.isTrue(isSupportedType(listener), "EventLisener is not a supported type"); + Assert.isTrue(isSupportedType(listener), "Listener is not of a supported type"); this.listener = listener; } diff --git a/spring-boot/src/test/java/org/springframework/boot/OverrideSourcesTests.java b/spring-boot/src/test/java/org/springframework/boot/OverrideSourcesTests.java index f31b78badd..2735b87606 100644 --- a/spring-boot/src/test/java/org/springframework/boot/OverrideSourcesTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/OverrideSourcesTests.java @@ -26,6 +26,9 @@ import org.springframework.context.annotation.Primary; import static org.junit.Assert.assertEquals; /** + * Tests for {@link SpringApplication} {@link SpringApplication#setSources(java.util.Set) + * source overrides}. + * * @author Dave Syer */ public class OverrideSourcesTests { diff --git a/spring-boot/src/test/java/org/springframework/boot/bind/BindingPreparationTests.java b/spring-boot/src/test/java/org/springframework/boot/bind/BindingPreparationTests.java index 90ec0be9b2..fef12d3d39 100644 --- a/spring-boot/src/test/java/org/springframework/boot/bind/BindingPreparationTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/bind/BindingPreparationTests.java @@ -24,7 +24,6 @@ import java.util.Map; import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.BeanWrapperImpl; -import org.springframework.boot.bind.RelaxedDataBinder; import org.springframework.boot.bind.RelaxedDataBinderTests.TargetWithNestedObject; import org.springframework.context.expression.MapAccessor; import org.springframework.core.convert.TypeDescriptor; 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 98eb01b61f..2a183c7008 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 @@ -20,7 +20,6 @@ import java.util.Collections; import org.junit.Before; import org.junit.Test; -import org.springframework.boot.bind.PropertySourcesPropertyValues; import org.springframework.core.env.MapPropertySource; import org.springframework.core.env.MutablePropertySources; import org.springframework.core.env.PropertySource; @@ -30,6 +29,7 @@ import static org.junit.Assert.assertEquals; /** * Tests for {@link PropertySourcesPropertyValues}. + * * @author Dave Syer */ public class PropertySourcesPropertyValuesTests { diff --git a/spring-boot/src/test/java/org/springframework/boot/config/JacksonParserTests.java b/spring-boot/src/test/java/org/springframework/boot/config/JacksonParserTests.java index 73d71ca034..29278d5277 100644 --- a/spring-boot/src/test/java/org/springframework/boot/config/JacksonParserTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/config/JacksonParserTests.java @@ -16,9 +16,6 @@ package org.springframework.boot.config; -import org.springframework.boot.config.JacksonJsonParser; -import org.springframework.boot.config.JsonParser; - /** * Tests for {@link JsonParser}. diff --git a/spring-boot/src/test/java/org/springframework/boot/config/YamlJsonParserTests.java b/spring-boot/src/test/java/org/springframework/boot/config/YamlJsonParserTests.java index 665b76604a..96c3898efb 100644 --- a/spring-boot/src/test/java/org/springframework/boot/config/YamlJsonParserTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/config/YamlJsonParserTests.java @@ -16,10 +16,6 @@ package org.springframework.boot.config; -import org.springframework.boot.config.JsonParser; -import org.springframework.boot.config.YamlJsonParser; - - /** * Tests for {@link YamlJsonParser}. * diff --git a/spring-boot/src/test/java/org/springframework/boot/config/YamlProcessorTests.java b/spring-boot/src/test/java/org/springframework/boot/config/YamlProcessorTests.java index e068a51175..b6a268b1cc 100644 --- a/spring-boot/src/test/java/org/springframework/boot/config/YamlProcessorTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/config/YamlProcessorTests.java @@ -19,7 +19,6 @@ import java.util.Map; import java.util.Properties; import org.junit.Test; -import org.springframework.boot.config.YamlProcessor; import org.springframework.boot.config.YamlProcessor.MatchCallback; import org.springframework.core.io.ByteArrayResource; import org.springframework.core.io.Resource; @@ -27,8 +26,9 @@ import org.springframework.core.io.Resource; import static org.junit.Assert.assertEquals; /** - * @author Dave Syer + * Tests for {@link YamlProcessor}. * + * @author Dave Syer */ public class YamlProcessorTests { diff --git a/spring-boot/src/test/java/org/springframework/boot/config/YamlPropertiesFactoryBeanTests.java b/spring-boot/src/test/java/org/springframework/boot/config/YamlPropertiesFactoryBeanTests.java index adf2829eb2..c7bba8ac45 100644 --- a/spring-boot/src/test/java/org/springframework/boot/config/YamlPropertiesFactoryBeanTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/config/YamlPropertiesFactoryBeanTests.java @@ -22,7 +22,6 @@ import java.util.Properties; import org.junit.Ignore; import org.junit.Test; -import org.springframework.boot.config.YamlPropertiesFactoryBean; import org.springframework.boot.config.YamlProcessor.DocumentMatcher; import org.springframework.boot.config.YamlProcessor.MatchStatus; import org.springframework.boot.config.YamlProcessor.ResolutionMethod; @@ -194,7 +193,6 @@ public class YamlPropertiesFactoryBeanTests { "foo:\n- bar:\n spam: crap\n- baz\n- one: two\n three: four" .getBytes()) }); Properties properties = factory.getObject(); - // System.err.println(properties); assertEquals("crap", properties.get("foo[0].bar.spam")); assertEquals("baz", properties.get("foo[1]")); assertEquals("two", properties.get("foo[2].one")); diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/ServletListenerRegistrationBeanTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/ServletListenerRegistrationBeanTests.java index 2899f34a0b..850d87771d 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/ServletListenerRegistrationBeanTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/ServletListenerRegistrationBeanTests.java @@ -16,6 +16,8 @@ package org.springframework.boot.context.embedded; +import java.util.EventListener; + import javax.servlet.ServletContext; import javax.servlet.ServletContextListener; @@ -57,4 +59,12 @@ public class ServletListenerRegistrationBeanTests { verify(this.servletContext).addListener(this.listener); } + @Test + public void cannotRegisterUnsupportedType() throws Exception { + this.thrown.expect(IllegalArgumentException.class); + this.thrown.expectMessage("Listener is not of a supported type"); + new ServletListenerRegistrationBean(new EventListener() { + }); + } + }