티스토리 뷰

Programming/Java

Spring Boot : profile 설정

파란크리스마스 2023. 6. 4. 15:41
728x90

출처

pom.xml

  <dependencies>
    <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web -->
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
      <version>2.2.4.RELEASE</version>
    </dependency>
  </dependencies>

SpringBootApplication

package com.bluexmas.example;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;

@SpringBootApplication
public class BluexmasApplication extends SpringBootServletInitializer {

    public static void main(String[] args) {
        SpringApplication.run(BluexmasApplication.class, args);
    }
    
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        //return super.configure(builder);
        return builder.sources(BluexmasApplication.class);
    }
}

resources\config\application-dev.properties

#http port
server.port=7070

Spring Profile 설정

-Dspring.profiles.active=dev

실행로그

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.2.4.RELEASE)

2023-06-04 15:34:47.637  INFO 13456 --- [           main] c.bluexmas.example.BluexmasApplication   : Starting BluexmasApplication on DESKTOP-F8HR1P3 with PID 13456 (D:\project2\phEMS\workspace.ems\spring-boot-example1\target\classes started by bluesanta in D:\project2\phEMS\workspace.ems\spring-boot-example1)
2023-06-04 15:34:47.640  INFO 13456 --- [           main] c.bluexmas.example.BluexmasApplication   : The following profiles are active: dev
2023-06-04 15:34:49.054  INFO 13456 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 7070 (http)
2023-06-04 15:34:49.064  INFO 13456 --- [           main] o.apache.catalina.core.StandardService   : 서비스 [Tomcat]을(를) 시작합니다.
2023-06-04 15:34:49.064  INFO 13456 --- [           main] org.apache.catalina.core.StandardEngine  : 서버 엔진을 시작합니다: [Apache Tomcat/9.0.31]
2023-06-04 15:34:49.299  INFO 13456 --- [           main] org.apache.jasper.servlet.TldScanner     : 적어도 하나의 JAR가 TLD들을 찾기 위해 스캔되었으나 아무 것도 찾지 못했습니다. 스캔했으나 TLD가 없는 JAR들의 전체 목록을 보시려면, 로그 레벨을 디버그 레벨로 설정하십시오. 스캔 과정에서 불필요한 JAR들을 건너뛰면, 시스템 시작 시간과 JSP 컴파일 시간을 단축시킬 수 있습니다.
2023-06-04 15:34:49.307  INFO 13456 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2023-06-04 15:34:49.307  INFO 13456 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1606 ms
2023-06-04 15:34:49.480  INFO 13456 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2023-06-04 15:34:49.644  INFO 13456 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 7070 (http) with context path ''
2023-06-04 15:34:49.648  INFO 13456 --- [           main] c.bluexmas.example.BluexmasApplication   : Started BluexmasApplication in 2.423 seconds (JVM running for 2.838)
댓글
300x250
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함