๐ฑ Spring boot - Banner ๋ณ๊ฒฝ
Spring Boot๋ ๊ธฐ๋ณธ์ ์ผ๋ก ์ ํ๋ฆฌ์ผ์ด์ ์ด ์คํ๋ ๋ ์ฝ์์ Spring ๋ก๊ณ ์ ๋ฒ์ ์ ํฌํจํ ๋ฐฐ๋๋ฅผ ์ถ๋ ฅํ๋ค.
์ด๋ฅผ ์ค์ ํ๋ ค๋ฉด ์๋ ๋ฐฉ๋ฒ ์ค ํ๋๋ฅผ ์ ํํ๋ฉด ๋๋ค
๋ฐฐ๋ ๋นํ์ฑํ
๋ฐฐ๋๋ฅผ ๋นํ์ฑํํ๋ ค๋ฉด application.properties ๋๋ application.yml ํ์ผ์ ๋ค์ ์ค์ ์ ์ถ๊ฐ
application.properties
spring.main.banner-mode=off
application.yml
spring:
main:
banner-mode: off
๋ฐฐ๋ ์ปค์คํฐ๋ง์ด์ง
src/main/resources ๋๋ ํ ๋ฆฌ์ banner.txt ํ์ผ์ ์์ฑํ ํ, ์ํ๋ ํ ์คํธ๋ฅผ ์ถ๊ฐํ๋ฉด ๋๋ค
banner.txt
,--. ,--. ,--.
| | | |,---. | |,---. ,---. ,--,--,--.,---.
| |.'.| | .-. :| | .--'| .-. || | .-. :
| ,'. \ --.| \ `--.' '-' '| | | \ --.
'--' '--'`----'`--'`---' `---' `--`--`--'`----'
Powered by Spring Boot ${spring-boot.version}
application.properties
# banner ์ค์
spring.main.banner-mode=console
spring.banner.location=banner.txt
ํ ์คํธ ์ ๋ ฅ์ ๋ฐฐ๋๋ฅผ ์๋์ผ๋ก ๋ง๋ค์ด์ฃผ๋ ์ฌ์ดํธ
https://devops.datenkollektiv.de/banner.txt/index.html
Spring Boot banner.txt generator
devops.datenkollektiv.de
ANSI ์์ ์ฝ๋๋ฅผ ์ถ๊ฐํ์ฌ ์ปฌ๋ฌ ๋ฐฐ๋๋ฅผ ๋ง๋ค ์๋ ์๋ค
${AnsiColor.RED} ____ ${AnsiColor.YELLOW} Spring Boot App ${AnsiColor.DEFAULT}
ANSI ์์ ํ:
- AnsiColor.RED
- AnsiColor.GREEN
- AnsiColor.YELLOW
- AnsiColor.BLUE
- AnsiColor.MAGENTA
- AnsiColor.CYAN
- AnsiColor.WHITE
- AnsiColor.DEFAULT
์ฝ๋๋ก ๋ฐฐ๋ ์ค์
Java ์ฝ๋๋ก ๋ฐฐ๋๋ฅผ ์ค์ ํ๋ ค๋ฉด SpringAplication ๊ฐ์ฒด์ ์ง์ ๋ฐฐ๋๋ฅผ ์ถ๊ฐํ ์ ์๋ค
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication app = new SpringApplication(Application.class);
app.setBanner((environment, sourceClass, out) -> {
out.println("==================================");
out.println(" Custom Spring Boot Banner ");
out.println("==================================");
});
app.setBannerMode(Banner.Mode.CONSOLE);
app.run(args);
}
}