[JAVA] How to boot by environment with Spring Boot of Maven

It is a method to divide by environment such as cache setting during development with springBoot.

First, create application.yml for each environment and write the settings.

$ touch resources/application-dev.yml
$ touch resources/application-test.yml

After that, add options when starting maven. Then application.yml for each environment will be loaded.

// application-dev.yml is loaded
$ maven spring-boot:run -Drun.profiles=dev
// application-test.yml is loaded
$ maven spring-boot:run -Drun.profiles=test

Supplement: Spring Boot 2.0 migration is as follows.

$maven spring-boot:run -Dspring-boot.run.profiles=dev
$maven spring-boot:run -Dspring-boot.run.profiles=test

Recommended Posts

How to boot by environment with Spring Boot of Maven
How to use MyBatis2 (iBatis) with Spring Boot 1.4 (Spring 4)
How to use built-in h2db with spring boot
Build Spring Boot project by environment with Gradle
How to use CommandLineRunner in Spring Batch of Spring Boot
How to set environment variables in the properties file of Spring boot application
How to set Spring Boot + PostgreSQL
How to use ModelMapper (Spring boot)
Extract SQL to property file with jdbcTemplate of spring boot
Switch environment by boot argument with SpringBoot
Hello World with Eclipse + Spring Boot + Maven
How to create your own Controller corresponding to / error with Spring Boot
How to set JAVA_HOME with Maven appassembler-maven-plugin
[Java] [Maven3] Summary of how to use Maven3
How to split Spring Boot message file
Let's find out how to receive in Request Body with REST API of Spring Boot
How to realize huge file upload with Rest Template of Spring
How to build Rails 6 environment with Docker
[Spring Boot] I investigated how to implement post-processing of the received request.
How to execute with commands of normal development language in Docker development environment
How to access Socket directly with the TCP function of Spring Integration
Introduction to Java development environment & Spring Boot application created with VS Code
Spring Boot environment construction with Docker (January 2021 version)
Configure Spring Boot application with maven multi module
How to make Spring Boot Docker Image smaller
How to use Spring Boot session attributes (@SessionAttributes)
The story of raising Spring Boot 1.5 series to 2.1 series
Try to implement login function with Spring Boot
How to add a classpath in Spring Boot
How to bind to property file in Spring Boot
Try to automate migration with Spring Boot Flyway
[Java] Article to add validation with Spring Boot 2.3.1.
I wanted to gradle spring boot with multi-project
Create Spring Boot environment with Windows + VS Code
[Rails] How to build an environment with Docker
[Spring Boot] How to refer to the property file
[Introduction to Spring Boot] Authentication function with Spring Security
Spring Boot --How to set session timeout time
Create a Spring Boot development environment with docker
Spring boot development-development environment-
Download with Spring Boot
How to perform UT with Excel as test data with Spring Boot + JUnit5 + DBUnit
How to build an environment of [TypeScript + Vue + Express + MySQL] with Docker ~ Vue edition ~
I tried to clone a web application full of bugs with Spring Boot
Part2 Part II. How to proceed with Getting Started Spring Boot Reference Guide Note ①
Settings for connecting to MySQL with Spring Boot + Spring JDBC
Include external jar in package with Spring boot2 + Maven3
[Rails] How to search by multiple values ​​with LIKE
How to set Dependency Injection (DI) for Spring Boot
How to apply HandlerInterceptor to http inbound-gateway of Spring Integration
How to write a unit test for Spring Boot 2
How to build docker environment with Gradle for intelliJ
[Java] How to omit spring constructor injection with Lombok
A memorandum of addiction to Spring Boot2 x Doma2
Access the built-in h2db of spring boot with jdbcTemplate
05. I tried to stub the source of Spring Boot
I tried to reduce the capacity of Spring Boot
[Spring Boot] How to create a project (for beginners)
[Docker environment] How to deal with ActiveSupport :: MessageEncryptor :: InvalidMessage
SSO with GitHub OAuth in Spring Boot 1.5.x environment
Create Restapi with Spring Boot ((1) Until Run of App)