DEV Community

Prasanth
Prasanth

Posted on

How to change spring boot banner and set to the spring profile

How to change spring boot banner in Eclipse IDE?

Step 1: Open your spring Boot Project in Eclipse
Step 2: Open src/main/resources Folder in eclipse

  • In the project Explorer (left side)

expand:

Image description

step 3: Right click resource folder -> New -> file -> Give name LOWER Case Letter only.

Example: banner.txt
then click Finish.

like

src/main/resources/banner.txt
Enter fullscreen mode Exit fullscreen mode

step 4: Add custom banner content

open your created file paste your custom test or ASCLL art.

Example:-

Image description

IF you want your own ASCLL text:

https://patorjk.com/software/taag

Step 5: Right click main class(@SpringBootApplication)

Runs As -> Java Application

IF you Do not Want Banner:-

Step 1: Open application.properties in your project.

Location src/main/resource in Double click application.properties add below line.

spring.main.banner-mode=off

Enter fullscreen mode Exit fullscreen mode

What is a Spring Profile?

In Spring Boot , a profile is a to define different configuration for different environment

For example:

dev (development)
test (testing)
prod (production)

Above mention each profile separate beans(objects) or you configuration setting tells that where you app is running.

Why use Profile?

just think like:

in development ,you want to connect to local database.
int production , you want to connect to live database.

Spring Profile help you switch easily between configuration without changing main code.

How to Set a spring Profile:-

1. create separate Property Files:-

go to:

src/main/resources/

Right click resources folder -> new -> file

create files like:-

application-dev.properties

application-prod.properties

inside file type your configuration details

2. In application.properties

=> application.properties

spring.profiles.active=dev

3.Run the Application :

Right-click main class → Run As → Java Application

Top comments (0)