이 영역을 누르면 첫 페이지로 이동
나눔코딩 블로그의 첫 페이지로 이동

나눔코딩

페이지 맨 위로 올라가기

나눔코딩

04. Spring Boot 2.4 Profile 적용 안되던 문제

  • 2021.09.08 20:57
  • ∞. 트러블 슈팅 + TIL
문제

더 이상 사용되지 않는 구성 속성 'spring.profiles'

 

원인

Spring Boot 2.4 버전 부터 application profile 을 작성하는 방식이 달라졌습니다 (아래 참고)

http://honeymon.io/tech/2021/01/16/spring-boot-config-data-migration.html

 

[spring-boot] 2.4 부터 변경된 구성파일 처리방식 살펴보기 - I'm honeymon(JiHeon Kim).

스프링 부트 2.4(https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.4-Release-Notes) 출시노트를 살펴보면 인상적인 2가지가 있다. 애플케이션 구성파일(application.yml 혹은 application.properties)의 작동방식

honeymon.io

 

https://stackoverflow.com/questions/64907675/including-profiles-in-spring-boot-2-4-0-version

 

Including profiles in spring boot 2.4.0 version

As a developer, I use the default dev profile in my local development environment. Here is part of my application-dev.properties file: # Profiles spring.profiles.include=auth Previously I used

stackoverflow.com

 

 

해결
이전 방식
# application.yml
spring:
  profiles:
    include: app, h2, oauth2
		# 결과적으로는 app , h2, oauth2-naver, oauth2-kakao, oauth2-google 이 설정된다
# application-h2.yml
spring:
  datasource:
    url: jdbc:h2:mem:testdb
    username: sa
    password:

  jpa:
    show-sql: true
    hibernate:
      ddl-auto: create
    properties:
      hibernate:
        format_sql: true
  h2:
    console:
      enabled: true
# application-app.yml
app:
	test: 'appConfig'
# application-oauth2.yml
spring:
  profiles:
    include: naver, kakao, google

---
spring:
  profiles: naver
  security:
    oauth2:
      client:
        registration:
          naver:
		        # client id, client-secret, redirect-uri, scope, client-name
        provider:
          naver:
            # authorization_uri, token_uri, user-info-uri, user_name_attribute
     
---
spring:
  profiles: kakao
  security:
    oauth2:
      client:
        registration:
          naver:
		        # client id, client-secret, redirect-uri, scope, client-name
        provider:
          naver:
            # authorization_uri, token_uri, user-info-uri, user_name_attribute
---
spring:
  profiles: google
  security:
    oauth2:
      client:
        registration:
          naver:
		        # client id, client-secret, redirect-uri, scope, client-name
        provider:
          naver:
            # authorization_uri, token_uri, user-info-uri, user_name_attribute
---
spring:
  profiles: facebook
  security:
    oauth2:
      client:
        registration:
          naver:
		        # client id, client-secret, redirect-uri, scope, client-name
        provider:
          naver:
            # authorization_uri, token_uri, user-info-uri, user_name_attribute
---
spring:
  profiles: github
  security:
    oauth2:
      client:
        registration:
          naver:
		        # client id, client-secret, redirect-uri, scope, client-name
        provider:
          naver:
            # authorization_uri, token_uri, user-info-uri, user_name_attribute

 

변경된 방식
# application.yml
spring:
  profiles:
    group:
      local:
        - h2
        - app
        - oauth2
      prod:
        - h2
        - app
    active: local

# 결과적으로 local( h2, app, oauth2-naver, oauth2-kakao, oauth2-google) 로 설정 된다
# application-app.yml
app:
	test: 'appConfig'
# application-h2.yml
spring:
  datasource:
    url: jdbc:h2:mem:testdb
    username: sa
    password:

  jpa:
    show-sql: true
    hibernate:
      ddl-auto: create
    properties:
      hibernate:
        format_sql: true
  h2:
    console:
      enabled: true
# application-oauth2.yml
spring:
  config:
    import:
      - classpath:/oauth2/application-naver.yml
      - classpath:/oauth2/application-kakao.yml
      - classpath:/oauth2/application-google.yml
  profiles:
    group:
      - naver
      - kakao
      - google
# /oauth2/application-naver.yml
spring:
  profiles: naver
  security:
    oauth2:
      client:
        registration:
          naver:
		        # client id, client-secret, redirect-uri, scope, client-name
        provider:
          naver:
            # authorization_uri, token_uri, user-info-uri, user_name_attribute
# /oauth2/application-kakao.yml
spring:
  profiles: kakao
  security:
    oauth2:
      client:
        registration:
          naver:
		        # client id, client-secret, redirect-uri, scope, client-name
        provider:
          naver:
            # authorization_uri, token_uri, user-info-uri, user_name_attribute
# /oauth2/application-google.yml
spring:
  profiles: google
  security:
    oauth2:
      client:
        registration:
          naver:
		        # client id, client-secret, redirect-uri, scope, client-name
        provider:
          naver:
            # authorization_uri, token_uri, user-info-uri, user_name_attribute
저작자표시 (새창열림)

'∞. 트러블 슈팅 + TIL' 카테고리의 다른 글

06. Spring Security OAuth JWT Test  (0) 2021.09.08
05. Spring Boot 2.4 Test 와 Profile  (0) 2021.09.08
03. Spring Boot 2.x CrossOrigin 문제  (0) 2021.09.08
02. JPA Querydsl cannot find symbol 에러  (0) 2021.09.08
01. Vue 2 Sass Loader 문제  (0) 2021.09.08

댓글

이 글 공유하기

  • 구독하기

    구독하기

  • 카카오톡

    카카오톡

  • 라인

    라인

  • 트위터

    트위터

  • Facebook

    Facebook

  • 카카오스토리

    카카오스토리

  • 밴드

    밴드

  • 네이버 블로그

    네이버 블로그

  • Pocket

    Pocket

  • Evernote

    Evernote

다른 글

  • 06. Spring Security OAuth JWT Test

    06. Spring Security OAuth JWT Test

    2021.09.08
  • 05. Spring Boot 2.4 Test 와 Profile

    05. Spring Boot 2.4 Test 와 Profile

    2021.09.08
  • 03. Spring Boot 2.x CrossOrigin 문제

    03. Spring Boot 2.x CrossOrigin 문제

    2021.09.08
  • 02. JPA Querydsl cannot find symbol 에러

    02. JPA Querydsl cannot find symbol 에러

    2021.09.08
다른 글 더 둘러보기

정보

나눔코딩 블로그의 첫 페이지로 이동

나눔코딩

  • 나눔코딩의 첫 페이지로 이동

검색

메뉴

  • 홈
  • 태그
  • 방명록

카테고리

  • 분류 전체보기 (316)
    • ∞. 읽은 거리 (3)
    • ∞. 기술 면접 (61)
      • 1. 자료구조 (0)
      • 2. 네트워크 (9)
      • 3. 운영체제 (11)
      • 4. 데이터베이스 (13)
      • 5. 디자인 패턴 (0)
      • 6. 알고리즘 (0)
      • 7. 자바 (15)
      • 8. 자바스크립트 (7)
      • 9. 스프링 (5)
      • 10. 시큐리티 (1)
      • 11. 기타 (0)
      • 12. Vue (0)
    • ∞. 웹개발 유용한 사이트 (14)
    • ∞. 트러블 슈팅 + TIL (7)
    • 00. 출발 (9)
    • 01. 엑셀 (9)
      • 기초 (4)
      • 컴활 1급 (4)
      • VBA (0)
    • 02. 엑세스 (9)
      • 기초 (5)
      • 컴활 1급 (4)
    • 04. Oracle (1)
      • 기초 (1)
    • 03. JAVA (8)
      • 기초 (7)
      • 객체지향 프로그래밍 (0)
    • 05. HTML (13)
      • 기초 (1)
      • css (10)
      • sass (0)
      • less (0)
    • 06. Javascript (16)
      • 기초 (13)
      • ES6 모듈 (2)
      • Canvas (0)
    • 07. JSP (0)
      • 기초 (0)
    • 08. jQuery (0)
      • 기초 (0)
    • 09. BootStrap (1)
      • 기초 (0)
      • v4 - Layout (1)
    • 10. Spring (30)
      • 기초 (3)
      • 실험 (4)
      • MVC (1)
      • BOOT (6)
      • Security (10)
      • Lib (Library) (2)
      • 벤치마킹 (0)
      • JUnit5 (2)
      • DevTools (0)
      • Socket (1)
      • Batch (0)
      • Mobile (0)
      • WebFlux (0)
      • Cloud (0)
      • Thymleaf (0)
      • Actuator (0)
      • 성능 테스트 (1)
    • 11. JetBrains (34)
      • 기초 (1)
      • IntelliJ IDEA (33)
      • WebStorm (0)
      • Pycham (0)
    • 12. API (0)
      • 기초 (0)
      • 네이버 API (0)
      • 카카오 API (0)
      • 구글 API (0)
      • 인스타그램 API (0)
    • 13. AutoHotkey (1)
    • 14. Python (8)
      • 기초 (3)
      • Selenium (2)
      • Beautiful Soup (0)
      • openpyxl (1)
      • Pyqt5 (0)
      • Deep learning (open CV) (0)
      • Geocoder (0)
      • Anaconda (0)
      • DeepLearning (0)
      • Jupyter Nootbook (0)
    • 14.5. R (0)
    • 15. JMeter (0)
      • 다운로드 (0)
    • 16. Vue JS (23)
      • 기초 (3)
      • Vue 2 (15)
      • Vue 3 (5)
      • Vuetify 2.5.8 (0)
    • 17. Git (12)
      • 기초 (8)
      • ItelliJ IDEA (4)
      • SourceTree (0)
    • 18. AWS (5)
      • 기초 (2)
      • Jira (3)
    • 19. Naver Cloud Platform (0)
    • 20. Google Cloud Platform (0)
      • 기초 (0)
      • stt & tts (0)
    • 21. Kotlin (0)
    • 22. Android (0)
      • 기초 (0)
      • Java (0)
      • Kotlin (0)
      • Flutter FrameWork (0)
    • 23. Clean Code [JAVA] (1)
    • 24. BuildTool (1)
      • Maven (1)
      • Gradle (0)
    • 25. 자료 구조와 알고리즘 (18)
      • JAVA (1)
      • Java Script (1)
      • 프로그래머스 (0)
      • 백준 알고리즘 (0)
      • 나의 알고리즘 (14)
      • Brilliant 공부 (0)
    • 26. React (1)
      • 기초 (0)
      • 강의 정리 (1)
    • 27. PostMan (0)
      • 기초 (0)
    • 28. 프로그래머스 (9)
    • 29. Leet Code (0)
    • 30. MySQL (3)
      • 기초 (2)
      • 문제 (1)
    • 73. GraphQL (0)
    • 74. Nuxt JS (0)
    • 75. Electron (0)
    • 76. UX & UI Design Tool (0)
      • 기초 (0)
      • Axure (0)
      • Sketch (0)
      • Figma (0)
    • 77. MarkDown (1)
      • 기초 (1)
    • 78. Tomcat (1)
      • 메모 (1)
    • 79. Element JS (0)
    • 80. Parallax JS (0)
      • 기초 (0)
    • 81. Player JS (0)
      • 기초 (0)
    • 82. Smart Maker (0)
    • 83. Vim (0)
      • 기초 (0)
    • 84. Linux (0)
      • 기초 (0)
      • Centos 7 (0)
      • Ubuntu (0)
    • 85. Node JS (2)
      • 기초 (1)
      • WebRTC (0)
      • NVM (1)
    • 86. Propeller JS (0)
    • 87. FullPage JS (0)
      • 기초 (0)
    • 88. 아두이노 (0)
    • 89. Tensorflow (0)
    • 90. 웹 패킷 분석 (0)
    • 91. 크롬 개발자도구 (0)
    • 92. 디자인 패턴 (7)
      • 생성(Creational) (3)
      • 구조(Structral) (1)
      • 행위(Behavioral) (2)
      • SOLID 패턴 (0)
    • 95. Linux Shell Script (0)
    • 96. 구글 애널리스틱 (0)
    • 97. ffmpeg (0)
    • 98. ShareX (1)
    • 자료실 (0)
    • 기타 (2)

최근 글

인기 글

댓글

공지사항

아카이브

태그

  • 엑셀 가운데맞춤
  • 엑셀 분석작업
  • 엑셀 표시형식
  • 엑셀 기타작업
  • 졵
  • 엑셀 기본작업
  • 엑셀 글씨
  • 깁

나의 외부 링크

  • 비전공자 개발자
  • 자바 디자인 패턴
  • 자바 디자인 패턴
  • 스프링 블로그
  • 해킹보안 & 웹 관련
  • ERD 생성
  • 전문 기술 블로그
  • Servlet에 대한 개념없이 스프링을 했네요?
  • 스프링 FitlerChainList
  • 알고리즘 파워 블로그

정보

THE HEYDAZE의 나눔코딩

나눔코딩

THE HEYDAZE

블로그 구독하기

  • 구독하기
  • RSS 피드

방문자

  • 전체 방문자
  • 오늘
  • 어제

티스토리

  • 티스토리 홈
  • 이 블로그 관리하기
  • 글쓰기
Powered by Tistory / Kakao. © THE HEYDAZE. Designed by Fraccino.

티스토리툴바