From 5df52d3e94af148fb2d918eb56500fa85d1405e1 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 28 May 2014 17:35:15 +0100 Subject: [PATCH] Polish --- .../boot/cli/compiler/GroovyCompiler.java | 5 ++-- .../SpringTestCompilerAutoConfiguration.java | 26 +++++++------------ .../src/main/asciidoc/using-spring-boot.adoc | 17 +++++++----- .../builder/SpringApplicationBuilder.java | 23 ++++++++-------- 4 files changed, 35 insertions(+), 36 deletions(-) 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 490f5755f18..ff374ba2a96 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 @@ -292,7 +292,7 @@ public class GroovyCompiler { @SuppressWarnings("unchecked") private static ClassNode getMainClass(CompilationUnit source) { - return getMainClass((List) source.getAST().getClasses()); + return getMainClass(source.getAST().getClasses()); } private static ClassNode getMainClass(List classes) { @@ -305,8 +305,7 @@ public class GroovyCompiler { return node; } } - return classes.isEmpty() ? null : classes.get(0); - + return (classes.isEmpty() ? null : classes.get(0)); } } 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 c65b3bd90ef..a08586bbd37 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 @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,9 +34,9 @@ import org.springframework.boot.cli.compiler.GroovyCompilerConfiguration; * {@link CompilerAutoConfiguration} for Spring Test * * @author Dave Syer + * @since 1.1.0 */ -public class SpringTestCompilerAutoConfiguration extends - CompilerAutoConfiguration { +public class SpringTestCompilerAutoConfiguration extends CompilerAutoConfiguration { @Override public boolean matches(ClassNode classNode) { @@ -46,28 +46,22 @@ public class SpringTestCompilerAutoConfiguration extends @Override public void apply(GroovyClassLoader loader, - GroovyCompilerConfiguration configuration, - GeneratorContext generatorContext, SourceUnit source, - ClassNode classNode) throws CompilationFailedException { + GroovyCompilerConfiguration configuration, GeneratorContext generatorContext, + SourceUnit source, ClassNode classNode) throws CompilationFailedException { if (!AstUtils.hasAtLeastOneAnnotation(classNode, "RunWith")) { - AnnotationNode runwith = new AnnotationNode( - ClassHelper.make("RunWith")); - runwith.addMember( - "value", - new ClassExpression(ClassHelper - .make("SpringJUnit4ClassRunner"))); + AnnotationNode runwith = new AnnotationNode(ClassHelper.make("RunWith")); + runwith.addMember("value", + new ClassExpression(ClassHelper.make("SpringJUnit4ClassRunner"))); classNode.addAnnotation(runwith); } } @Override - public void applyImports(ImportCustomizer imports) - throws CompilationFailedException { + public void applyImports(ImportCustomizer imports) throws CompilationFailedException { imports.addStarImports("org.junit.runner") .addStarImports("org.springframework.boot.test") .addStarImports("org.springframework.test.context.junit4") .addStarImports("org.springframework.test.annotation") - .addImports( - "org.springframework.test.context.web.WebAppConfiguration"); + .addImports("org.springframework.test.context.web.WebAppConfiguration"); } } diff --git a/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc b/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc index 26e14b11086..6015ea1b151 100644 --- a/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc +++ b/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc @@ -567,6 +567,8 @@ This allows you to attach a debugger to your packaged application: -jar target/myproject-0.0.1-SNAPSHOT.jar ---- + + [[using-boot-running-with-the-maven-plugin]] === Using the Maven plugin The Spring Boot Maven plugin includes a `run` goal which can be used to quickly compile @@ -580,9 +582,10 @@ resources for instant ``hot'' reload. Useful operating system environment variable: -``` -$ export MAVEN_OPTS=-Xmx1024m -XX:MaxPermSize=128M -Djava.security.egd=file:/dev/./urandom -``` +[indent=0,subs="attributes"] +---- + $ export MAVEN_OPTS=-Xmx1024m -XX:MaxPermSize=128M -Djava.security.egd=file:/dev/./urandom +---- (The "egd" setting is to speed up Tomcat startup by giving it a faster source of entropy for session keys.) @@ -599,9 +602,11 @@ the `spring-boot-plugin` Useful operating system environment variable: -``` -$ export JAVA_OPTS=-Xmx1024m -XX:MaxPermSize=128M -Djava.security.egd=file:/dev/./urandom -``` +[indent=0,subs="attributes"] +---- + $ export JAVA_OPTS=-Xmx1024m -XX:MaxPermSize=128M -Djava.security.egd=file:/dev/./urandom +---- + [[using-boot-hot-swapping]] diff --git a/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java b/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java index 12cbda3d582..5aca2719815 100644 --- a/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java +++ b/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java @@ -83,18 +83,19 @@ public class SpringApplicationBuilder { this.application = createSpringApplication(sources); } - /** - * Creates a new {@link org.springframework.boot.SpringApplication} instances from the given sources. Subclasses may - * override in order to provide a custom subclass of {@link org.springframework.boot.SpringApplication} - * - * @param sources The sources - * @return The {@link org.springframework.boot.SpringApplication} instance - */ - protected SpringApplication createSpringApplication(Object... sources) { - return new SpringApplication(sources); - } + /** + * Creates a new {@link org.springframework.boot.SpringApplication} instances from the + * given sources. Subclasses may override in order to provide a custom subclass of + * {@link org.springframework.boot.SpringApplication} + * @param sources The sources + * @return The {@link org.springframework.boot.SpringApplication} instance + * @since 1.1.0 + */ + protected SpringApplication createSpringApplication(Object... sources) { + return new SpringApplication(sources); + } - /** + /** * Accessor for the current application context. * @return the current application context (or null if not yet running) */