Spring Boot QuickStart 2: Property configuration

Source: Internet
Author: User

Property configuration: Configuring in Application.properties

First step: Configure the port number and project name and start

Step two: View requests in the browser

The second configuration: configured in APPLICATION.YML. (more commonly used)

Note: Two profiles retain only one other delete

First step: Configure and start the Project project

Step two: View the request in the browser

Custom property Configuration:

First step: Configure custom properties in Application.yml

Step two: Invoke and start the project in the controller

Step three: Browser view requests

Configuration content used in configuration:

First step: Configure custom properties in Application.yml

Step two: Invoke and start the project in the controller

Step three: Browser view requests

Custom configuration becomes automatic Configuration object Common Properties

First step: Configure custom properties in Application.yml

Step two: Create a Girlproperties object

Step three: Invoke and start the project in the controller

Fourth Step: Browser View request

Configuration file Invocation:

There are two configuration files for the development environment Profile APPLICATION-DEV.YML and for the production environment, respectively APPLICATION-PROD.YML

Development environment configuration file Application-dev.yml

Configuration file for production environment APPLICATION-PROD.YML

The first step: Configure the calling development environment configuration file

Or configure the Invoke production environment configuration file

Step two: Start the project and view the request in the browser

Or

configuration file Invocation: The second way terminal calls

The first step: Open the terminal into the project and directory:

Input command: Cd/users/liuxiaoming/documents/software/ideawork/girl (based on the actual address of your project)

Step two: Compile the project

Input command: mvn install

Step three: Enter the target file to find the jar file for the project

Fourth Step:

Input: Java-jar Girl-0.0.1-snapshot.jar--spring.profiles.active=prod

Invoking a production configuration file to start a project


Fifth Step: Browser View request

At this point, you configure the development environment and start the project in the idea configuration file. The development is now running at the same time as the production environment

Spring Boot QuickStart 2: Property configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.