Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How SpringBoot2 customizes the startup page, packages the project, and specifies the runtime environment

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces SpringBoot2 how to customize the startup page, project packaging and designated operating environment, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

I. introduction to Packaging

There are many ways to package springboot. Can be packed with war package, can be packed with jar package, and can be packaged and deployed using jekins. War package is not recommended. SpringBoot is suitable for the separation of front and rear ends, and it is more convenient and faster to deploy it as jar.

Second, customize the startup page

Banner.txt content

= No BUG===

This replaces the startup style of SpringBoot.

Third, packaging configuration 1. Package pom configuration ${project.artifactId} src/main/resources true org.apache.maven.plugins maven-compiler-plugin 2.3.2 1.8 1.8 Org.springframework.boot spring-boot-maven-plugin-Dfile.encoding=UTF-8 true repackage Org.apache.maven.plugins maven-surefire-plugin true 2 、 Multi-environment configuration

1) application.yml configuration

Server: port: 8017spring: application: name: node17-boot-package profiles: active: dev

2) application-dev.yml configuration

Project: sign: develop

3) application-pro.yml configuration

Project: sign: product3, environment test interface package com.boot.pack.controller;import org.springframework.beans.factory.annotation.Value;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RestController;@RestControllerpublic class PackController {@ Value ("${project.sign}") private String sign; @ RequestMapping ("/ getSign") public String getSign () {return sign 4. Package execution 1. Specify module to package mvn clean install-pl node17-boot-package-am-Dmaven.test.skip=true to generate Jar package: node17-boot-package.jar

2. Run the Jar package

Run the dev environment

Java-jar node17-boot-package.jar-spring.profiles.active=dev

Run the pro environment

Java-jar node17-boot-package.jar-spring.profiles.active=pro

Http://localhost:8017/getSigndev environment printing: developpro environment printing: product thank you for reading this article carefully. I hope the article "how to customize the startup page, project packaging and specify the running environment for SpringBoot2" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report