From c3d71bbf4b6e56efbfbd1c27c91d5568d7bf6e5a Mon Sep 17 00:00:00 2001 From: jameskleeh Date: Tue, 25 Oct 2016 16:05:31 -0400 Subject: [PATCH] Set banner mode to OFF instead of overriding printBanner method --- .../main/groovy/grails/boot/GrailsApp.groovy | 38 +++++++++++++++---- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/grails-core/src/main/groovy/grails/boot/GrailsApp.groovy b/grails-core/src/main/groovy/grails/boot/GrailsApp.groovy index 502dfec2859..e1649f23e4a 100644 --- a/grails-core/src/main/groovy/grails/boot/GrailsApp.groovy +++ b/grails-core/src/main/groovy/grails/boot/GrailsApp.groovy @@ -9,7 +9,6 @@ import grails.util.BuildSettings import grails.util.Environment import groovy.transform.CompileDynamic import groovy.transform.CompileStatic -import groovy.transform.InheritConstructors import groovy.util.logging.Slf4j import org.codehaus.groovy.control.CompilationFailedException import org.codehaus.groovy.control.CompilationUnit @@ -22,9 +21,11 @@ import org.grails.io.watch.DirectoryWatcher import org.grails.io.watch.FileExtensionFileChangeListener import org.grails.plugins.BinaryGrailsPlugin import org.grails.plugins.support.WatchPattern +import org.springframework.boot.Banner import org.springframework.boot.SpringApplication import org.springframework.context.ConfigurableApplicationContext import org.springframework.core.env.ConfigurableEnvironment +import org.springframework.core.io.ResourceLoader import java.util.concurrent.ConcurrentLinkedQueue @@ -36,7 +37,6 @@ import java.util.concurrent.ConcurrentLinkedQueue * @since 3.0 */ @CompileStatic -@InheritConstructors @Slf4j class GrailsApp extends SpringApplication { @@ -45,6 +45,35 @@ class GrailsApp extends SpringApplication { boolean enableBeanCreationProfiler = false + /** + * Create a new {@link GrailsApp} instance. The application context will load + * beans from the specified sources (see {@link SpringApplication class-level} + * documentation for details. The instance can be customized before calling + * {@link #run(String...)}. + * @param sources the bean sources + * @see #run(Object, String[]) + * @see #GrailsApp(org.springframework.core.io.ResourceLoader, Object...) + */ + public GrailsApp(Object... sources) { + super(sources) + bannerMode = Banner.Mode.OFF + } + + /** + * Create a new {@link GrailsApp} instance. The application context will load + * beans from the specified sources (see {@link SpringApplication class-level} + * documentation for details. The instance can be customized before calling + * {@link #run(String...)}. + * @param resourceLoader the resource loader to use + * @param sources the bean sources + * @see #run(Object, String[]) + * @see #GrailsApp(org.springframework.core.io.ResourceLoader, Object...) + */ + public GrailsApp(ResourceLoader resourceLoader, Object... sources) { + super(resourceLoader, sources) + bannerMode = Banner.Mode.OFF + } + @Override ConfigurableApplicationContext run(String... args) { def applicationContext = super.run(args) @@ -330,11 +359,6 @@ class GrailsApp extends SpringApplication { } } - @Override - protected void printBanner(org.springframework.core.env.Environment environment) { - // noop - } - /** * Static helper that can be used to run a {@link GrailsApp} from the * specified source using default settings.