Spring Boot is a light-weight framework that allows you to create independent, production-level, Spring-based, and out-of-box applications. This topic describes how to develop a simple Spring Boot application and deploy the application in Web+.
Step 1: Create a Demo project
- Start IntelliJ IDEA.
- Choose File > New > Project to create a new project.
- You need to configure the project and complete the creation.
- In the left-side navigation pane, click Spring Initializr and click Next.
- You need to configure the required project settings. After the configuration is complete, click Next.
- On the Dependencies page, click Web, select Spring Web Starter, and then click Next.
- Enter a project name and click Finish to complete the creation procedure.
- Open the pom.xml file in the project directory, and add the code shown in the rectangular box of the following figure to the file.
Step 2: Configure an application
- Create a new controller.
- Click Debug to start the application.
- Enter the address shown in the following figure in the address bar of your browser to access the application.
Step 3: Build an executable JAR file
- Click the Maven tab and click Execute Maven Goal. In the Execute Maven Goal dialog box, enter package in the Command line field, and click Execute.
- After you archive the project, a JAR package is created in the target directory of the project, for example, demo-0.0.1-SNAPSHOT.jar. Then, you need to deploy the application in Web App Service.
Step 4: Create and deploy an application
- Log on to the Web+ console.
- On the Overview page, click Create in the upper-right corner of the Last Updated Deployment Environments section.
- In the Basic Information step, select Java in the Technology Stack Type field and enter an application name and description. After the configuration is complete, click Next.
- In the Environment Information step, enter a environment name, select Upload Local Application in the Deployment Package Source field, and upload the demo-0.0.1-SNAPSHOT.jar deployment package. After configuring the deployment package version, click Creation Complete.
- In the Finish step, click View Application or Creation Complete to go to the Overview tab of the Application Details page. Click the name of a deployment environment to go to the Overview tab of the Deployment Environment Details page. Then, click the link next to the Public IP Address tab to view the homepage of the application.
- For more information about how to deploy an application in the console, see Deploy applications.
- For more information about how to use the CLI tool to create and deploy an application, see Use the CLI to quickly deploy applications.
- For more information about management tasks after you host an application, see Overview of application details.
- For more information about how to manage deployment environments where applications reside, see Deployment environment overview.