스프링 부트 배너 없애기

NB_ Allen·2021년 1월 19일
0

스프링 부트

목록 보기
2/6

package com.rubypaper;

import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication // 스프링 부트로 만든 애플리케이션의 시작 클래스 정의
public class Chapter01Application {

	public static void main(String[] args) {
		//SpringApplication.run(Chapter01Application.class, args);
		
		SpringApplication application =
				new SpringApplication(Chapter01Application.class);
		
		// WebApplicationType.NONE  설정하면 자바 애플릿으로 실행됨.
		application.setWebApplicationType(WebApplicationType.NONE);
		application.setBannerMode(Banner.Mode.OFF);
		application.run(args);
	}

}

배너대신 콘솔창으로 출력해보자

package com.rubypaper;

import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication // 스프링 부트로 만든 애플리케이션의 시작 클래스 정의
public class Chapter01Application {

	public static void main(String[] args) {
		//SpringApplication.run(Chapter01Application.class, args);
		
		SpringApplication application =
				new SpringApplication(Chapter01Application.class);
		
		// WebApplicationType.NONE  설정하면 자바 애플릿으로 실행됨.
		application.setWebApplicationType(WebApplicationType.SERVLET);
		application.setBannerMode(Banner.Mode.OFF);
		application.run(args);
	}

}
# 이름 규칙 
# web-application-type ( 대소문자를 구분 안하는 경우 )
# webApplicationType ( 대소문자를 구분 하는 경우 )

# 우선순위가 application.properties 가 높다. 

# 톰캣 PORT 번호 
server.port=8085

# 서블릿 또는 자바애플릿 선택 ( none , SERVLET )
spring.main.web-application-type=SERVLET

# " none " or " console "   배너 설정
spring.main.banner-mode=console
spring.banner.location=banner/banner.txt
#############################

Allen

SPRING BOOT START 

${spring-boot.formatted-version} 

#############################

0개의 댓글