IBM TechXchange Group

 View Only
  • 1.  How to add banner to a Spring-Boot Application

    Posted Thu March 09, 2023 02:22 AM
    Edited by DC Kumawat Thu March 09, 2023 02:22 AM

    How to generate and add banner in a new Spring Boot Development Page



  • 2.  RE: How to add banner to a Spring-Boot Application

    Posted Mon March 13, 2023 10:24 AM
    Edited by Jayson Billy Fri March 17, 2023 12:30 PM

    Follow the steps below and use the code. 

    1- Create a new file named banner.txt in the src/main/resources directory of your Spring Boot project.

    2- Add your banner text to the banner.txt file. The banner text should be ASCII art, and it will be displayed in the console when the Spring Boot application starts.

    3- In your Spring Boot application, add the following code to the main class:

    @SpringBootApplication
    public class MyApplication {

        public static void main(String[] args) {
            SpringApplication app = new SpringApplication(MyApplication.class);
            app.setBannerMode(Banner.Mode.CONSOLE);
            app.run(args);
        }
    }


    Run your Spring Boot application, and the banner text will be displayed in the console.
    Note that you can also set the Banner.Mode.OFF mode to turn off the banner display, or Banner.Mode.LOG mode to log the banner text instead of displaying it in the console.

    This might help you brother. I recently fixed this issue for this, you can check it. 



    ------------------------------
    Jayson Billy
    ------------------------------



  • 3.  RE: How to add banner to a Spring-Boot Application

    Posted Mon March 20, 2023 04:58 AM
    Edited by DC Kumawat Mon March 20, 2023 04:58 AM

    thanks jayson to help me


    Original Message:
    Sent: Sat March 11, 2023 04:08 AM
    From: Jayson Billy
    Subject: How to add banner to a Spring-Boot Application

    Follow the steps below and use the code. 

    1- Create a new file named banner.txt in the src/main/resources directory of your Spring Boot project.

    2- Add your banner text to the banner.txt file. The banner text should be ASCII art, and it will be displayed in the console when the Spring Boot application starts.

    3- In your Spring Boot application, add the following code to the main class:

    @SpringBootApplication
    public class MyApplication {

        public static void main(String[] args) {
            SpringApplication app = new SpringApplication(MyApplication.class);
            app.setBannerMode(Banner.Mode.CONSOLE);
            app.run(args);
        }
    }


    Run your Spring Boot application, and the banner text will be displayed in the console.
    Note that you can also set the Banner.Mode.OFF mode to turn off the banner display, or Banner.Mode.LOG mode to log the banner text instead of displaying it in the console.

    This might help you brother. I recently fixed this issue for this, you can check it. 



    ------------------------------
    Jayson Billy



  • 4.  RE: How to add banner to a Spring-Boot Application

    Posted Tue April 11, 2023 03:57 AM

    To add a banner to a Spring Boot application, you can create a file named "banner.txt" in the "src/main/resources" directory of your project. The file should contain ASCII art that represents the banner. Spring Boot will automatically detect and display the banner on application startup.

    Alternatively, you can customize the banner by setting the "spring.banner.location" property in your application.properties file to the location of your custom banner file. For example, if you have a banner.txt file in a directory named "config" at the root of your classpath, you would add the following to your application.properties file:

     
    spring.banner.location=classpath:config/banner.txt

    You can also customize the banner font, colors, and other properties using the "spring.banner.*" properties in your application.properties file. For more information, refer to the Spring Boot documentation.



    ------------------------------
    David Warner
    ------------------------------