SpringBoot 2.0 Foundation Case (17): Custom Start Page, Project Packaging, and Specified Running Environment

A Brief Introduction to Packaging

Springboot is packaged in many ways. You can use war packages, jar packages, and jekins for packaging and deployment. It is not recommended to use war packages. SpringBoot is suitable for front-end and back-end separation. It is more convenient and fast to deploy as jar.

Custom Start Page

Content of banner.txt

        No BUG

This replaces the original SpringBook startup style.

Packing Configuration

1. Packing pom configuration

<!-- Project construction -->
        <!-- SpringBoot Plug-in unit: JDK Compiler plug-in -->
        <!-- SpringBoot Plug-in: Packing -->
        <!-- Skip unit testing -->

2. Multi-environment Configuration

1) application.yml configuration

  port: 8017
    name: node17-boot-package
    active: dev

2) application-dev.yml configuration

  sign: develop

3) application-pro.yml configuration

  sign: product

3. 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;
public class PackController {
    private String sign ;
    public String getSign (){
        return sign ;

IV. Packaging Execution

1. Designated Module Packaging

mvn clean install -pl node17-boot-package -am -Dmaven.test.skip=true
//Generate Jar packages: node17-boot-package.jar

2. Running the Jar package

Running dev environment
java -jar node17-boot-package.jar --spring.profiles.active=dev
Running pro environment
java -jar node17-boot-package.jar --spring.profiles.active=pro

dev Environment Printing: develop
pro Environment Printing: product

5. Source code address

GitHub Address: Know a smile
 Code Yun Address: Know a smile

Keywords: Java Spring Maven SpringBoot Apache

Added by Caps on Tue, 08 Oct 2019 11:42:02 +0300