Develop/Springboot

springboot - application.yml 설정 | springboot - application.yml Configuration

[oauth2 google 관련 yml]spring: security: oauth2: client: registration: google : client : client-id : [GCP 발급 ID] clientSecret: [GCP 발급 Secret key] accessTokenUri: https://www.googleapis.com/o/oauth2/token userAuthorizationUri: https://accounts.google.com/o/oauth2/auth clientAuthenticationScheme: form ..

springboot - application.yml 설정 | springboot - application.yml Configuration

728x90

[oauth2 google 관련 yml]

spring:
  security:
    oauth2:
      client:
        registration:
         google :
          client :
            client-id : [GCP 발급 ID]
            clientSecret: [GCP 발급 Secret key]
            accessTokenUri: https://www.googleapis.com/o/oauth2/token
            userAuthorizationUri: https://accounts.google.com/o/oauth2/auth
            clientAuthenticationScheme: form
            provider: github
            scope:
              - email
              - profile
          resource:
            userInfoUri: https://www.googleapis.com/oauth2/v2/userinfo

 client-id의 끝은 .apps.googleusercontent.com 이다.

 

[jpa및 db설정 관련 yml]

spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://[서버 url]/[DB 스키마]?serverTimezone=UTC&characterEncoding=UTF-8
    username: root
    password:

  jpa:
    show-sql: true
    hibernate:
      format_sql: true
      ddl-auto: create
 
 logging:
  level:
    org:
      hibernate:
        SQL: DEBUG
        type:
          trace

 

[security관련 yml]

security:
  basic:
    enabled: false # security 기본 인증 옵션 제거

 

[내가 임의로 설정하는 yml]

test-propertiy:
  id: jyami
  secret: ajkflhjaskfhldfahjklfbdn

사용법

@Component
@Getter
@Setter
@ConfigurationProperties(prefix = "test-property")
public class TokenConfig {
    private String id;
    private String secret;
}

[OAuth2 Google-related yml]

spring:
  security:
    oauth2:
      client:
        registration:
         google :
          client :
            client-id : [GCP issued ID]
            clientSecret: [GCP issued Secret key]
            accessTokenUri: https://www.googleapis.com/o/oauth2/token
            userAuthorizationUri: https://accounts.google.com/o/oauth2/auth
            clientAuthenticationScheme: form
            provider: github
            scope:
              - email
              - profile
          resource:
            userInfoUri: https://www.googleapis.com/oauth2/v2/userinfo

 The client-id ends with .apps.googleusercontent.com.

 

[JPA and DB configuration-related yml]

spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://[server url]/[DB schema]?serverTimezone=UTC&characterEncoding=UTF-8
    username: root
    password:

  jpa:
    show-sql: true
    hibernate:
      format_sql: true
      ddl-auto: create
 
 logging:
  level:
    org:
      hibernate:
        SQL: DEBUG
        type:
          trace

 

[Security-related yml]

security:
  basic:
    enabled: false # Remove default security authentication option

 

[Custom yml I set myself]

test-propertiy:
  id: jyami
  secret: ajkflhjaskfhldfahjklfbdn

Usage

@Component
@Getter
@Setter
@ConfigurationProperties(prefix = "test-property")
public class TokenConfig {
    private String id;
    private String secret;
}

댓글

Comments