

Images are converted into an ASCII art representation and printed above any text banner. In addition to a text file, you can also add a banner.gif, banner.jpg, or banner.png image file to your classpath or set the property. If the file has an encoding other than UTF-8, you can set. The banner that is printed on start up can be changed by adding a banner.txt file to your classpath or by setting the property to the location of such a file. If you want to disable lazy initialization for certain beans while using lazy initialization for the rest of the application, you can explicitly set their lazy attribute to false using the annotation. Lazy initialization can be enabled programmatically using the lazyInitialization method on SpringApplicationBuilder or the setLazyInitialization method on SpringApplication.Īlternatively, it can be enabled using the -initialization property as shown in the following example: If a misconfigured bean is initialized lazily, a failure will no longer occur during startup and the problem will only become apparent when the bean is initialized.Ĭare must also be taken to ensure that the JVM has sufficient memory to accommodate all of the application’s beans and not just those that are initialized during startup.įor these reasons, lazy initialization is not enabled by default and it is recommended that fine-tuning of the JVM’s heap size is done before enabling lazy initialization. In a web application, enabling lazy initialization will result in many web-related beans not being initialized until an HTTP request is received.Ī downside of lazy initialization is that it can delay the discovery of a problem with the application. When lazy initialization is enabled, beans are created as they are needed rather than during application startup.Īs a result, enabling lazy initialization can reduce the time that it takes your application to start. SpringApplication allows an application to be initialized lazily. $ java -jar myproject-0.0.1-SNAPSHOT.jar -debug

If your application fails to start, registered FailureAnalyzers get a chance to provide a dedicated error message and a concrete action to fix the problem.įor instance, if you start a web application on port 8080 and that port is already in use, you should see something similar to the following message: To add additional logging during startup, you can override logStartupInfo(boolean) in a subclass of SpringApplication. This will also turn off logging of the application’s active profiles. Startup information logging can be turned off by setting -startup-info to false. The application version is determined using the implementation version from the main application class’s package. If you need a log level other than INFO, you can set it, as described in Log Levels.

10:33:26.384 INFO 17900 - o.s.b.d.s.s.SpringApplicationExample : Started SampleTomcatApplication in 1.514 seconds (JVM running for 1.823)īy default, INFO logging messages are shown, including some relevant startup details, such as the user that launched the application. 10:33:26.144 INFO 17900 - s.tomcat.SampleTomcatApplication : ServletContext initialized 10:33:26.097 INFO 17900 - w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 821 ms : Initializing Spring embedded WebApplicationContext 10:33:26.055 INFO 17900 - .StandardEngine : Starting Servlet engine: 10:33:25.226 INFO 17900 - o.s.b.d.s.s.SpringApplicationExample : No active profile set, falling back to default profiles: default 10:33:25.224 INFO 17321 - o.s.b.d.s.s.SpringApplicationExample : Starting SpringApplicationExample using Java 1.8.0_232 on mycomputer with PID 17321 (/apps/myjar.jar started by pwebb) Configuring System Environment Properties Using the ApplicationRunner or CommandLineRunner
