Spring Boot- Disable Spring banner at startup
In your Spring Boot application, you can disable the Spring logo banner at the startup of the application. It can be done by a configuration file (application.properties or application.yaml) as well as programmatically.
Similar Post: How to change default banner text in Spring Boot
1. Configuration file
Set the following below property in the Spring Boot configuration file.
application.properties
spring.main.banner-mode = offWhen using the application.yaml:
application.yaml
spring:
main:
banner-mode: "off"2. Programmatically
Set the banner mode OFF in the Spring Boot startup class.
SpringBootBannerApp.java
package org.websparrow;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringBootBannerApp {
public static void main(String[] args) {
SpringApplication app = new SpringApplication(SpringBootBannerApp.class);
app.setBannerMode(Banner.Mode.OFF);
app.run(args);
}
}When using the SpringApplicationBuilder:
SpringBootBannerApp.java
package org.websparrow;
import org.springframework.boot.Banner;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
@SpringBootApplication
public class SpringBootBannerApp {
public static void main(String[] args) {
new SpringApplicationBuilder(SpringBootBannerApp.class)
.bannerMode(Banner.Mode.OFF)
.run(args);
}
}References
Similar Posts
- Spring 5 auto scanning using @Component annotation and XML configuration
- How to read properties file in Spring
- Spring Setter-based Dependency Injection Example
- Spring @RestControllerAdvice Annotation Example
- Spring depends on attribute example
- Spring Boot – Calling REST Services with RestTemplate
- Difference between @PreAuthorize and @PostAuthorize Annotations in Spring Security
- How to fetch image from database using Spring MVC
- Difference Between @Component and @ComponentScan Annotations in Spring Boot
- Failed to start bean ‘documentationPluginsBootstrapper’; nested exception is java.lang.NullPointerException