Commit 5df52d3e authored by Phillip Webb's avatar Phillip Webb

Polish

parent 5d797ce0
...@@ -292,7 +292,7 @@ public class GroovyCompiler { ...@@ -292,7 +292,7 @@ public class GroovyCompiler {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private static ClassNode getMainClass(CompilationUnit source) { private static ClassNode getMainClass(CompilationUnit source) {
return getMainClass((List<ClassNode>) source.getAST().getClasses()); return getMainClass(source.getAST().getClasses());
} }
private static ClassNode getMainClass(List<ClassNode> classes) { private static ClassNode getMainClass(List<ClassNode> classes) {
...@@ -305,8 +305,7 @@ public class GroovyCompiler { ...@@ -305,8 +305,7 @@ public class GroovyCompiler {
return node; return node;
} }
} }
return classes.isEmpty() ? null : classes.get(0); return (classes.isEmpty() ? null : classes.get(0));
} }
} }
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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; ...@@ -34,9 +34,9 @@ import org.springframework.boot.cli.compiler.GroovyCompilerConfiguration;
* {@link CompilerAutoConfiguration} for Spring Test * {@link CompilerAutoConfiguration} for Spring Test
* *
* @author Dave Syer * @author Dave Syer
* @since 1.1.0
*/ */
public class SpringTestCompilerAutoConfiguration extends public class SpringTestCompilerAutoConfiguration extends CompilerAutoConfiguration {
CompilerAutoConfiguration {
@Override @Override
public boolean matches(ClassNode classNode) { public boolean matches(ClassNode classNode) {
...@@ -46,28 +46,22 @@ public class SpringTestCompilerAutoConfiguration extends ...@@ -46,28 +46,22 @@ public class SpringTestCompilerAutoConfiguration extends
@Override @Override
public void apply(GroovyClassLoader loader, public void apply(GroovyClassLoader loader,
GroovyCompilerConfiguration configuration, GroovyCompilerConfiguration configuration, GeneratorContext generatorContext,
GeneratorContext generatorContext, SourceUnit source, SourceUnit source, ClassNode classNode) throws CompilationFailedException {
ClassNode classNode) throws CompilationFailedException {
if (!AstUtils.hasAtLeastOneAnnotation(classNode, "RunWith")) { if (!AstUtils.hasAtLeastOneAnnotation(classNode, "RunWith")) {
AnnotationNode runwith = new AnnotationNode( AnnotationNode runwith = new AnnotationNode(ClassHelper.make("RunWith"));
ClassHelper.make("RunWith")); runwith.addMember("value",
runwith.addMember( new ClassExpression(ClassHelper.make("SpringJUnit4ClassRunner")));
"value",
new ClassExpression(ClassHelper
.make("SpringJUnit4ClassRunner")));
classNode.addAnnotation(runwith); classNode.addAnnotation(runwith);
} }
} }
@Override @Override
public void applyImports(ImportCustomizer imports) public void applyImports(ImportCustomizer imports) throws CompilationFailedException {
throws CompilationFailedException {
imports.addStarImports("org.junit.runner") imports.addStarImports("org.junit.runner")
.addStarImports("org.springframework.boot.test") .addStarImports("org.springframework.boot.test")
.addStarImports("org.springframework.test.context.junit4") .addStarImports("org.springframework.test.context.junit4")
.addStarImports("org.springframework.test.annotation") .addStarImports("org.springframework.test.annotation")
.addImports( .addImports("org.springframework.test.context.web.WebAppConfiguration");
"org.springframework.test.context.web.WebAppConfiguration");
} }
} }
...@@ -567,6 +567,8 @@ This allows you to attach a debugger to your packaged application: ...@@ -567,6 +567,8 @@ This allows you to attach a debugger to your packaged application:
-jar target/myproject-0.0.1-SNAPSHOT.jar -jar target/myproject-0.0.1-SNAPSHOT.jar
---- ----
[[using-boot-running-with-the-maven-plugin]] [[using-boot-running-with-the-maven-plugin]]
=== Using the Maven plugin === Using the Maven plugin
The Spring Boot Maven plugin includes a `run` goal which can be used to quickly compile 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. ...@@ -580,9 +582,10 @@ resources for instant ``hot'' reload.
Useful operating system environment variable: Useful operating system environment variable:
``` [indent=0,subs="attributes"]
$ export MAVEN_OPTS=-Xmx1024m -XX:MaxPermSize=128M -Djava.security.egd=file:/dev/./urandom ----
``` $ 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.) (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` ...@@ -599,9 +602,11 @@ the `spring-boot-plugin`
Useful operating system environment variable: Useful operating system environment variable:
``` [indent=0,subs="attributes"]
$ export JAVA_OPTS=-Xmx1024m -XX:MaxPermSize=128M -Djava.security.egd=file:/dev/./urandom ----
``` $ export JAVA_OPTS=-Xmx1024m -XX:MaxPermSize=128M -Djava.security.egd=file:/dev/./urandom
----
[[using-boot-hot-swapping]] [[using-boot-hot-swapping]]
......
...@@ -83,18 +83,19 @@ public class SpringApplicationBuilder { ...@@ -83,18 +83,19 @@ public class SpringApplicationBuilder {
this.application = createSpringApplication(sources); this.application = createSpringApplication(sources);
} }
/** /**
* Creates a new {@link org.springframework.boot.SpringApplication} instances from the given sources. Subclasses may * Creates a new {@link org.springframework.boot.SpringApplication} instances from the
* override in order to provide a custom subclass of {@link org.springframework.boot.SpringApplication} * given sources. Subclasses may override in order to provide a custom subclass of
* * {@link org.springframework.boot.SpringApplication}
* @param sources The sources * @param sources The sources
* @return The {@link org.springframework.boot.SpringApplication} instance * @return The {@link org.springframework.boot.SpringApplication} instance
*/ * @since 1.1.0
protected SpringApplication createSpringApplication(Object... sources) { */
return new SpringApplication(sources); protected SpringApplication createSpringApplication(Object... sources) {
} return new SpringApplication(sources);
}
/**
/**
* Accessor for the current application context. * Accessor for the current application context.
* @return the current application context (or null if not yet running) * @return the current application context (or null if not yet running)
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment