mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Polish
This commit is contained in:
parent
5d797ce00f
commit
5df52d3e94
@ -292,7 +292,7 @@ public class GroovyCompiler {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
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) {
|
||||
@ -305,8 +305,7 @@ public class GroovyCompiler {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
return classes.isEmpty() ? null : classes.get(0);
|
||||
|
||||
return (classes.isEmpty() ? null : classes.get(0));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
@ -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]]
|
||||
|
@ -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)
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user