diff --git a/docs/howto.md b/docs/howto.md index a588335fe3..0de4953d25 100644 --- a/docs/howto.md +++ b/docs/howto.md @@ -200,7 +200,7 @@ webapp or service: spring-boot-starter-jetty - + ## Terminate SSL in Tomcat @@ -818,7 +818,7 @@ change the behaviour: classpath resource or a URL). A separate `Environment` property source is set up for this document and it can be overridden by system properties, environment variables or the command line. - + No matter what you set in the environment, Spring Boot will always load `application.properties` as described above. If YAML is used then files with the ".yml" extension are also added to the list by default. @@ -942,4 +942,4 @@ it with after which you can run the application with $ java -jar target/*.jar - + diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AbstractEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AbstractEndpoint.java index 717f5a905a..9b62efd36f 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AbstractEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AbstractEndpoint.java @@ -55,6 +55,7 @@ public abstract class AbstractEndpoint implements Endpoint { this.id = id; } + @Override public boolean isEnabled() { return this.enabled; } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanExporter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanExporter.java index 7e4fa77918..4830f49a90 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanExporter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanExporter.java @@ -186,14 +186,17 @@ public class EndpointMBeanExporter extends MBeanExporter implements SmartLifecyc // SmartLifeCycle implementation + @Override public final int getPhase() { return this.phase; } + @Override public final boolean isAutoStartup() { return this.autoStartup; } + @Override public final boolean isRunning() { this.lifecycleLock.lock(); try { @@ -204,6 +207,7 @@ public class EndpointMBeanExporter extends MBeanExporter implements SmartLifecyc } } + @Override public final void start() { this.lifecycleLock.lock(); try { @@ -217,6 +221,7 @@ public class EndpointMBeanExporter extends MBeanExporter implements SmartLifecyc } } + @Override public final void stop() { this.lifecycleLock.lock(); try { @@ -229,6 +234,7 @@ public class EndpointMBeanExporter extends MBeanExporter implements SmartLifecyc } } + @Override public final void stop(Runnable callback) { this.lifecycleLock.lock(); try { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpoint.java index b8564a4cef..7c7ea90d24 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpoint.java @@ -68,6 +68,7 @@ public class JolokiaMvcEndpoint implements MvcEndpoint, InitializingBean, this.controller.afterPropertiesSet(); } + @Override public void setServletContext(ServletContext servletContext) { this.controller.setServletContext(servletContext); } @@ -76,6 +77,7 @@ public class JolokiaMvcEndpoint implements MvcEndpoint, InitializingBean, this.controller.setInitParameters(initParameters); } + @Override public final void setApplicationContext(ApplicationContext context) throws BeansException { this.controller.setApplicationContext(context); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/SimpleHealthIndicatorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/SimpleHealthIndicatorTests.java index 930211ed9f..2afa405d09 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/SimpleHealthIndicatorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/SimpleHealthIndicatorTests.java @@ -34,6 +34,8 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; /** + * Tests for {@link SimpleHealthIndicator}. + * * @author Dave Syer */ public class SimpleHealthIndicatorTests { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaBaseConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaBaseConfiguration.java index f5127fbae7..d16d731a15 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaBaseConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaBaseConfiguration.java @@ -73,7 +73,8 @@ public abstract class JpaBaseConfiguration implements BeanFactoryAware, Environm @Bean @ConditionalOnMissingBean(EntityManagerFactoryInfo.class) - public LocalContainerEntityManagerFactoryBean entityManagerFactory(JpaVendorAdapter jpaVendorAdapter) { + public LocalContainerEntityManagerFactoryBean entityManagerFactory( + JpaVendorAdapter jpaVendorAdapter) { LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); entityManagerFactoryBean.setJpaVendorAdapter(jpaVendorAdapter); entityManagerFactoryBean.setDataSource(getDataSource()); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/AbstractJpaAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/AbstractJpaAutoConfigurationTests.java index 142c980260..90b3b5031a 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/AbstractJpaAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/AbstractJpaAutoConfigurationTests.java @@ -137,10 +137,8 @@ public abstract class AbstractJpaAutoConfigurationTests { @Test public void usesManuallyDefinedEntityManagerFactoryBeanIfAvailable() { - setupTestConfiguration(TestConfigurationWithEntityManagerFactory.class); this.context.refresh(); - LocalContainerEntityManagerFactoryBean factoryBean = this.context .getBean(LocalContainerEntityManagerFactoryBean.class); Map map = factoryBean.getJpaPropertyMap(); @@ -149,10 +147,8 @@ public abstract class AbstractJpaAutoConfigurationTests { @Test public void usesManuallyDefinedTransactionManagerBeanIfAvailable() { - setupTestConfiguration(TestConfigurationWithTransactionManager.class); this.context.refresh(); - PlatformTransactionManager txManager = this.context .getBean(PlatformTransactionManager.class); assertThat(txManager, instanceOf(CustomJpaTransactionManager.class)); diff --git a/spring-boot-cli/samples/integration.groovy b/spring-boot-cli/samples/integration.groovy index 13d846f186..3051fa7c13 100644 --- a/spring-boot-cli/samples/integration.groovy +++ b/spring-boot-cli/samples/integration.groovy @@ -8,7 +8,7 @@ class SpringIntegrationExample implements CommandLineRunner { DirectChannel input() { new DirectChannel(); } - + @Override void run(String... args) { print new MessagingTemplate(input()).convertSendAndReceive("World") @@ -23,4 +23,4 @@ class HelloTransformer { "Hello, ${payload}" } -} \ No newline at end of file +} diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandCompleter.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandCompleter.java index ec48f4937f..5d0e837fc2 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandCompleter.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandCompleter.java @@ -1,3 +1,19 @@ +/* + * Copyright 2012-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.springframework.boot.cli.command; import java.io.IOException; diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/PromptCommand.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/PromptCommand.java index b2c9ad0b7c..52210eeea3 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/PromptCommand.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/PromptCommand.java @@ -1,6 +1,21 @@ +/* + * 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 org.springframework.boot.cli.command.AbstractCommand; /** * @author Dave Syer @@ -10,7 +25,8 @@ public class PromptCommand extends AbstractCommand { private final ShellCommand runCmd; public PromptCommand(ShellCommand runCmd) { - super("prompt", "Change the prompt used with the current 'shell' command. Execute with no arguments to return to the previous value."); + super("prompt", "Change the prompt used with the current 'shell' command. " + + "Execute with no arguments to return to the previous value."); this.runCmd = runCmd; } @@ -18,10 +34,11 @@ public class PromptCommand extends AbstractCommand { public void run(String... strings) throws Exception { if (strings.length > 0) { for (String string : strings) { - runCmd.pushPrompt(string + " "); + this.runCmd.pushPrompt(string + " "); } - } else { - runCmd.popPrompt(); + } + else { + this.runCmd.popPrompt(); } } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/Shell.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/Shell.java index bde37f53ca..b2eb441da3 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/Shell.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/Shell.java @@ -1,3 +1,19 @@ +/* + * 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 java.io.IOException; @@ -12,7 +28,8 @@ public class Shell { public static void main(String... args) throws IOException { if (args.length == 0) { SpringCli.main("shell"); // right into the REPL by default - } else { + } + else { SpringCli.main(args); } } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/ShellCommand.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/ShellCommand.java index a661fb91e9..5e9e8a85e0 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/ShellCommand.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/ShellCommand.java @@ -1,3 +1,19 @@ +/* + * 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 java.io.IOException; @@ -26,8 +42,11 @@ import org.springframework.util.StringUtils; public class ShellCommand extends AbstractCommand { private String defaultPrompt = "$ "; + private SpringCli springCli; + private String prompt = this.defaultPrompt; + private Stack prompts = new Stack(); public ShellCommand(SpringCli springCli) { @@ -186,8 +205,8 @@ public class ShellCommand extends AbstractCommand { String version = ShellCommand.class.getPackage().getImplementationVersion(); version = (version == null ? "" : " (v" + version + ")"); System.out.println("Spring Boot CLI" + version); - System.out - .println("Hit TAB to complete. Type 'help' and hit RETURN for help, and 'quit' to exit."); + System.out.println("Hit TAB to complete. Type 'help' and hit " + + "RETURN for help, and 'quit' to exit."); } public void pushPrompt(String prompt) { diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/StopCommand.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/StopCommand.java index ec03306bcf..80e7d668be 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/StopCommand.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/StopCommand.java @@ -1,7 +1,21 @@ +/* + * 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 org.springframework.boot.cli.command.AbstractCommand; -import org.springframework.boot.cli.command.RunCommand; /** * @author Jon Brisbin @@ -11,13 +25,14 @@ public class StopCommand extends AbstractCommand { private final RunCommand runCmd; public StopCommand(RunCommand runCmd) { - super("stop", "Stop the currently-running application started with the 'run' command."); + super("stop", + "Stop the currently-running application started with the 'run' command."); this.runCmd = runCmd; } @Override public void run(String... strings) throws Exception { - runCmd.stop(); + this.runCmd.stop(); } } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/JreProxySelector.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/JreProxySelector.java index 1738971383..815336972a 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/JreProxySelector.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/JreProxySelector.java @@ -47,6 +47,7 @@ public final class JreProxySelector implements ProxySelector { public JreProxySelector() { } + @Override public Proxy getProxy(RemoteRepository repository) { List proxies = null; try { @@ -95,6 +96,7 @@ public final class JreProxySelector implements ProxySelector { public static final Authentication INSTANCE = new JreProxyAuthentication(); + @Override public void fill(AuthenticationContext context, String key, Map data) { Proxy proxy = context.getProxy(); @@ -136,6 +138,7 @@ public final class JreProxySelector implements ProxySelector { } } + @Override public void digest(AuthenticationDigest digest) { // we don't know anything about the JRE's current authenticator, assume the // worst (i.e. interactive) diff --git a/spring-boot-samples/spring-boot-sample-actuator-noweb/src/test/java/sample/actuator/SampleActuatorNoWebApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator-noweb/src/test/java/sample/actuator/SampleActuatorNoWebApplicationTests.java index 15107b99fb..0e37118280 100644 --- a/spring-boot-samples/spring-boot-sample-actuator-noweb/src/test/java/sample/actuator/SampleActuatorNoWebApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator-noweb/src/test/java/sample/actuator/SampleActuatorNoWebApplicationTests.java @@ -59,7 +59,7 @@ public class SampleActuatorNoWebApplicationTests { context.close(); } } - + @Test public void endpointsExist() throws Exception { assertNotNull(context.getBean(MetricsEndpoint.class)); diff --git a/spring-boot-samples/spring-boot-sample-secure/src/main/java/sample/ops/ui/SampleSecureApplication.java b/spring-boot-samples/spring-boot-sample-secure/src/main/java/sample/ops/ui/SampleSecureApplication.java index 69d5103da9..dba8855a73 100644 --- a/spring-boot-samples/spring-boot-sample-secure/src/main/java/sample/ops/ui/SampleSecureApplication.java +++ b/spring-boot-samples/spring-boot-sample-secure/src/main/java/sample/ops/ui/SampleSecureApplication.java @@ -53,7 +53,8 @@ public class SampleSecureApplication extends WebMvcConfigurerAdapter { public static void main(String[] args) throws Exception { // Set user password to "password" for demo purposes only new SpringApplicationBuilder(SampleSecureApplication.class).properties( - "security.basic.enabled=false", "security.user.password=password").run(args); + "security.basic.enabled=false", "security.user.password=password").run( + args); } @Override diff --git a/spring-boot-samples/spring-boot-sample-secure/src/test/java/sample/ops/ui/SampleSecureApplicationTests.java b/spring-boot-samples/spring-boot-sample-secure/src/test/java/sample/ops/ui/SampleSecureApplicationTests.java index c73f7bced8..d92650f5f4 100644 --- a/spring-boot-samples/spring-boot-sample-secure/src/test/java/sample/ops/ui/SampleSecureApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-secure/src/test/java/sample/ops/ui/SampleSecureApplicationTests.java @@ -57,7 +57,7 @@ public class SampleSecureApplicationTests { new Callable() { @Override public ConfigurableApplicationContext call() throws Exception { - return (ConfigurableApplicationContext) SpringApplication + return SpringApplication .run(SampleSecureApplication.class); } }); diff --git a/spring-boot-samples/spring-boot-sample-servlet/src/main/java/sample/servlet/SampleServletApplication.java b/spring-boot-samples/spring-boot-sample-servlet/src/main/java/sample/servlet/SampleServletApplication.java index 7f9f846795..c02d08f168 100644 --- a/spring-boot-samples/spring-boot-sample-servlet/src/main/java/sample/servlet/SampleServletApplication.java +++ b/spring-boot-samples/spring-boot-sample-servlet/src/main/java/sample/servlet/SampleServletApplication.java @@ -32,14 +32,14 @@ import org.springframework.context.annotation.Configuration; @Configuration @EnableAutoConfiguration public class SampleServletApplication { - + @SuppressWarnings("serial") @Bean public Servlet dispatcherServlet() { return new GenericServlet() { @Override - public void service(ServletRequest req, ServletResponse res) throws ServletException, - IOException { + public void service(ServletRequest req, ServletResponse res) + throws ServletException, IOException { res.setContentType("text/plain"); res.getWriter().append("Hello World"); } diff --git a/spring-boot-samples/spring-boot-sample-servlet/src/test/java/sample/servlet/SampleServletApplicationTests.java b/spring-boot-samples/spring-boot-sample-servlet/src/test/java/sample/servlet/SampleServletApplicationTests.java index 4e178a7663..4b6fa4946a 100644 --- a/spring-boot-samples/spring-boot-sample-servlet/src/test/java/sample/servlet/SampleServletApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-servlet/src/test/java/sample/servlet/SampleServletApplicationTests.java @@ -67,8 +67,8 @@ public class SampleServletApplicationTests { @Test public void testHome() throws Exception { - ResponseEntity entity = getRestTemplate("user", getPassword()).getForEntity( - "http://localhost:8080", String.class); + ResponseEntity entity = getRestTemplate("user", getPassword()) + .getForEntity("http://localhost:8080", String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals("Hello World", entity.getBody()); } diff --git a/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java index dfcd78ddbf..af01ed0524 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java @@ -56,7 +56,8 @@ public class NonAutoConfigurationSampleTomcatApplicationTests { @Configuration @Import({ EmbeddedServletContainerAutoConfiguration.class, - DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class, + DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class, + HttpMessageConvertersAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class }) @ComponentScan(basePackageClasses = { SampleController.class, HelloWorldService.class }) public static class NonAutoConfigurationSampleTomcatApplication { diff --git a/spring-boot-samples/spring-boot-sample-web-jsp/src/main/java/sample/jsp/WelcomeController.java b/spring-boot-samples/spring-boot-sample-web-jsp/src/main/java/sample/jsp/WelcomeController.java index 98eadcc8f8..4a701e2b6b 100644 --- a/spring-boot-samples/spring-boot-sample-web-jsp/src/main/java/sample/jsp/WelcomeController.java +++ b/spring-boot-samples/spring-boot-sample-web-jsp/src/main/java/sample/jsp/WelcomeController.java @@ -14,9 +14,9 @@ public class WelcomeController { private String message = "Hello World"; @RequestMapping("/") - public String welcome(Map model) { + public String welcome(Map model) { model.put("time", new Date()); - model.put("message", message ); + model.put("message", message); return "welcome"; } diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/SpringBootPlugin.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/SpringBootPlugin.java index 1670b64bab..fd99a2e362 100644 --- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/SpringBootPlugin.java +++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/SpringBootPlugin.java @@ -43,8 +43,7 @@ public class SpringBootPlugin implements Plugin { // register BootRepackage so that we can use // task foo(type: BootRepackage) {} - project.getExtensions().getExtraProperties() - .set("BootRepackage", Repackage.class); + project.getExtensions().getExtraProperties().set("BootRepackage", Repackage.class); Repackage packageTask = addRepackageTask(project); ensureTaskRunsOnAssembly(project, packageTask); addRunJarTask(project); diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/task/ProjectLibraries.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/task/ProjectLibraries.java index 4b9fcada10..8cb90bd50d 100644 --- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/task/ProjectLibraries.java +++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/task/ProjectLibraries.java @@ -1,3 +1,4 @@ + package org.springframework.boot.gradle.task; import java.io.File; @@ -20,6 +21,7 @@ class ProjectLibraries implements Libraries { private final Project project; private String providedConfigurationName = "providedRuntime"; + private String customConfigurationName = null; /** @@ -47,18 +49,16 @@ class ProjectLibraries implements Libraries { @Override public void doWithLibraries(LibraryCallback callback) throws IOException { - FileCollection custom = this.customConfigurationName != null ? this.project - .getConfigurations().findByName(this.customConfigurationName) : null; + FileCollection custom = this.customConfigurationName != null ? this.project.getConfigurations().findByName( + this.customConfigurationName) + : null; if (custom != null) { libraries(LibraryScope.CUSTOM, custom, callback); - } - else { - FileCollection compile = this.project.getConfigurations() - .getByName("compile"); + } else { + FileCollection compile = this.project.getConfigurations().getByName("compile"); - FileCollection runtime = this.project.getConfigurations() - .getByName("runtime"); + FileCollection runtime = this.project.getConfigurations().getByName("runtime"); runtime = runtime.minus(compile); FileCollection provided = this.project.getConfigurations().findByName( diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/task/Repackage.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/task/Repackage.java index a1da166a0c..0b59bcbdd2 100644 --- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/task/Repackage.java +++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/task/Repackage.java @@ -57,8 +57,7 @@ public class Repackage extends DefaultTask { } if (this.customConfiguration != null) { libraries.setCustomConfigurationName(this.customConfiguration); - } - else if (extension.getCustomConfiguration() != null) { + } else if (extension.getCustomConfiguration() != null) { libraries.setCustomConfigurationName(extension.getCustomConfiguration()); } project.getTasks().withType(Jar.class, new Action() { diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java index f789bc2e5a..449389e80e 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java @@ -39,7 +39,7 @@ import org.springframework.boot.loader.AsciiBytes; /** * {@link Archive} implementation backed by an exploded archive directory. - * + * * @author Phillip Webb */ public class ExplodedArchive extends Archive { @@ -72,7 +72,8 @@ public class ExplodedArchive extends Archive { private void buildEntries(File file) { if (!file.equals(this.root)) { - String name = file.toURI().getPath().substring(root.toURI().getPath().length()); + String name = file.toURI().getPath() + .substring(root.toURI().getPath().length()); FileEntry entry = new FileEntry(new AsciiBytes(name), file); this.entries.put(entry.getName(), entry); } @@ -88,7 +89,7 @@ public class ExplodedArchive extends Archive { @Override public URL getUrl() throws MalformedURLException { FilteredURLStreamHandler handler = new FilteredURLStreamHandler(); - return new URL("file", "", -1, this.root.toURI().getPath(), handler); + return new URL("file", "", -1, this.root.toURI().getPath(), handler); } @Override diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/ExplodedArchiveTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/ExplodedArchiveTests.java index 1edb58f278..39f67b06b7 100644 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/ExplodedArchiveTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/ExplodedArchiveTests.java @@ -121,8 +121,8 @@ public class ExplodedArchiveTests { Archive nested = this.archive.getNestedArchive(entry); Map nestedEntries = getEntriesMap(nested); assertThat(nestedEntries.size(), equalTo(1)); - assertThat(nested.getUrl().toString(), - equalTo("file:" + this.rootFolder.toURI().getPath() + "d/")); + assertThat(nested.getUrl().toString(), equalTo("file:" + + this.rootFolder.toURI().getPath() + "d/")); } @Test diff --git a/spring-boot/src/main/java/org/springframework/boot/config/SimpleJsonParser.java b/spring-boot/src/main/java/org/springframework/boot/config/SimpleJsonParser.java index d4b64b3ddc..d89da21473 100644 --- a/spring-boot/src/main/java/org/springframework/boot/config/SimpleJsonParser.java +++ b/spring-boot/src/main/java/org/springframework/boot/config/SimpleJsonParser.java @@ -76,24 +76,29 @@ public class SimpleJsonParser implements JsonParser { if (json.startsWith("[")) { return parseListInternal(json); } + if (json.startsWith("{")) { return parseMapInternal(json); } + if (json.startsWith("\"")) { return trimTrailingCharacter(trimLeadingCharacter(json, '"'), '"'); } + try { return Long.valueOf(json); } catch (NumberFormatException e) { // ignore } + try { return Double.valueOf(json); } catch (NumberFormatException e) { // ignore } + return json; } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainer.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainer.java index 595592188c..091e1c65b8 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainer.java @@ -45,6 +45,7 @@ public interface EmbeddedServletContainer { // Do nothing } + @Override public int getPort() { return 0; } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java index e66a398e86..bd749c7843 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java @@ -330,7 +330,8 @@ public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProc if (resource != null && resource.exists()) { for (PropertySourceLoader loader : loaders) { if (loader.supports(resource)) { - PropertySource propertySource = loader.load(resource.getDescription(), resource); + PropertySource propertySource = loader.load( + resource.getDescription(), resource); propertySources.addFirst(propertySource); } } diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java b/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java index 26f555f223..9e4886236b 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java @@ -77,11 +77,10 @@ public class LogbackLoggingSystem extends AbstractLoggingSystem { Assert.notNull(configLocation, "ConfigLocation must not be null"); String resolvedLocation = SystemPropertyUtils.resolvePlaceholders(configLocation); ILoggerFactory factory = StaticLoggerBinder.getSingleton().getLoggerFactory(); - Assert.isInstanceOf( - LoggerContext.class, - factory, - "LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (" - + factory.getClass() + ")"); + Assert.isInstanceOf(LoggerContext.class, factory, + "LoggerFactory is not a Logback LoggerContext but " + + "Logback is on the classpath. Either remove Logback " + + "or the competing implementation (" + factory.getClass() + ")"); LoggerContext context = (LoggerContext) factory; context.stop(); try { 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 e72f5a7850..7f978e5db6 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 @@ -179,6 +179,7 @@ public class MockEmbeddedServletContainerFactory extends return this.registeredFilters; } + @Override public int getPort() { return this.port; }