본문 바로가기
스프링 관련/스프링

참고 위한 application.yml 설정 파일 예시들 정리

by 문자메일 2023. 1. 16.

fastcampus-loan

server:
  port: 8080
spring:
  datasource:
    driverClassName: org.h2.Driver
    url: jdbc:h2:mem:testdb
    username: sa
    password:
  jpa:
    hibernate:
      ddl-auto: create
    properties:
      hibernate:
        format_sql: true
      naming:
        physical-strategy: org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy
    database-platform: org.hibernate.dialect.H2Dialect
  h2:
    console:
      path: /h2-console
      enabled: true
logging.level:
  org.hibernate.SQL: debug

 

sns


server:
  port: 9090

spring:
  jpa:
    hibernate:
      ddl-auto: update
    show-sql: true
    properties:
      hibernate:
        format_sql: true
  datasource:
    hikari:
      maximum-pool-size: 4
    url: jdbc:mysql://127.0.0.1:13306/pass_local?zeroDateTimeBehavior=convertToNull&characterEncoding=UTF-8&serverTimezone=Asia/Seoul
    username: pass_local_user
    password: passlocal123
    driver-class-name: com.mysql.cj.jdbc.Driver
  redis:
    url: redis://127.0.0.1:6379

jwt:
  secret-key: fast_campus.sns-application-2022.secret_key
  # 30day
  token:
    expired-time-ms: 2592000000

 

library-app

spring:
  datasource:
    url: 'jdbc:h2:mem:library'
    username: 'user'
    password: ''
    driver-class-name: org.h2.Driver
  jpa:
    hibernate:
      ddl-auto: create
    properties:
      hibernate:
        format_sql: true
        show_sql: true
  h2:
    console:
      enabled: true
      path: '/h2-console'

 

 

shopping-mall properties

server.port=9091

#MySQL ?? ??
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3307/shop?serverTimezone=UTC
spring.datasource.username=root
spring.datasource.password=root

#???? ?? ?? ??
spring.jpa.properties.hibernate.show_sql=true

#???? ???? ??? ???? ?? ???
spring.jpa.properties.hibernate.format_sql=true

spring.jpa.properties.hibernate.default_batch_fetch_size=1000

#??? ???? ???? ??? ???? ??
logging.level.org.hibernate.type.descriptor.sql=trace

spring.jpa.hibernate.ddl-auto=validate
spring.jpa.database-platform=org.hibernate.dialect.MySQL8Dialect

#Live Reload ?? ???
spring.devtools.livereload.enabled=true

#Thymeleaf cache ?? ??
spring.thymeleaf.cache = false

# ?? ? ?? ?? ???
spring.servlet.multipart.maxFileSize=20MB

# ??? ?? ?? ??
spring.servlet.multipart.maxRequestSize=100MB

# ?? ??? ??? ??
itemImgLocation:C:/shop/item

# ??? ??? ??
uploadPath=file:///C:/shop/

 

 

MSA user service


server:
  port: 0

spring:
  application:
    name: user-service
  zipkin:
    base-url: http://127.0.0.1:9411
    enabled: true
  sleuth:
    sampler:
      probability: 1.0
  rabbitmq:
    host: 127.0.0.1
    port: 5672
    username: guest
    password: guest
  h2:
    console:
      enabled: true
      settings:
        web-allow-others: true
      path: /h2-console
#  datasource:
#    driver-class-name: org.h2.Driver
#    url: jdbc:h2:mem:testdb
    # username: sa
    # password: 1234


eureka:
  instance:
    instance-id: ${spring.application.name}:${spring.application.instance_id:${random.value}}
  client:
    register-with-eureka: true
    fetch-registry: true
    service-url:
      defaultZone: http://127.0.0.1:8761/eureka


greeting:
  message: Welcome to the Simple E-commerce

logging:
  level:
    com.example.userservice.client: DEBUG

management:
  endpoints:
    web:
      exposure:
        include: refresh, health, beans, busrefresh, info, metrics, prometheus

#token:
#  expiration_time: 86400000
#  secret: user_token

 

 

MSA Discovery service

server:
  port: 8761

spring:
  application:
    name: discoveryservice

eureka:
  client:
    register-with-eureka: false
    fetch-registry: false

 

 

MSA Order service

server:
  port: 0

spring:
  application:
    name: order-service
  zipkin:
    base-url: http://127.0.0.1:9411
    enabled: true
  sleuth:
    sampler:
      probability: 1.0
  h2:
    console:
      enabled: true
      settings:
        web-allow-others: true
      path: /h2-console
  jpa:
    hibernate:
      ddl-auto: update

  datasource:
    driver-class-name: org.h2.Driver
    url: jdbc:h2:mem:testdb
#    url: jdbc:mariadb://localhost:3306/mydb
#    driver-class-name: org.mariadb.jdbc.Driver
#    username: root
#    password: Abc33151@@


eureka:
  instance:
    instance-id: ${spring.application.name}:${spring.application.instance_id:${random.value}}
  client:
    register-with-eureka: true
    fetch-registry: true
    service-url:
      defaultZone: http://127.0.0.1:8761/eureka

logging:
  level:
    com.example.orderservice: DEBUG

management:
  endpoints:
    web:
      exposure:
        include: health, httptrace, info, metrics, prometheus

 

MSA Catalog service

server:
  port: 0

spring:
  application:
    name: catalog-service
  h2:
    console:
      enabled: true
      settings:
        web-allow-others: true
      path: /h2-console
  jpa:
    hibernate:
      ddl-auto: 'create-drop'
    show-sql: true
    generate-ddl: true
    defer-datasource-initialization: true
  datasource:
    driver-class-name: org.h2.Driver
    url: jdbc:h2:mem:testdb
#    username: sa
#    password:


eureka:
  instance:
    instance-id: ${spring.application.name}:${spring.application.instance_id:${random.value}}
  client:
    register-with-eureka: true
    fetch-registry: true
    service-url:
      defaultZone: http://127.0.0.1:8761/eureka
logging:
  level:
    com.example.catalogservice: DEBUG

 

MSA Config service

server:
  port: 8888

spring:
  application:
    name: config-service
  rabbitmq:
    host: 127.0.0.1
    port: 5672
    username: guest
    password: guest
  profiles:
    active: native
  cloud:
    config:
      server:
        native:
          search-locations: file:///C:/code_folder/native-file-repo
        git:
          uri: #https://github.com/YeongBinByeon/spring-cloud-config

management:
  endpoints:
    web:
      exposure:
        include: health, busrefresh

 

MSA - API Gateway Service

server:
  port: 8000

eureka:
  client:
    register-with-eureka: true
    fetch-registry: true
    service-url:
      defaultZone: http://localhost:8761/eureka

spring:
  application:
    name: apigateway-service
  rabbitmq:
    host: 127.0.0.1
    port: 5672
    username: guest
    password: guest
  main:
    web-application-type: reactive
  cloud:
    gateway:
      routes:
#        - id: user-service
#          uri: lb://USER-SERVICE
#          predicates:
#            - Path=/user-service/**
        - id: user-service
          uri: lb://USER-SERVICE
          predicates:
            - Path=/user-service/login
            - Method=POST
          filters:
            - RemoveRequestHeader=Cookie
            - RewritePath=/user-service/(?<segment>.*), /$\{segment}
        - id: user-service
          uri: lb://USER-SERVICE
          predicates:
            - Path=/user-service/users
            - Method=POST
          filters:
            - RemoveRequestHeader=Cookie
            - RewritePath=/user-service/(?<segment>.*), /$\{segment}
        - id: user-service
          uri: lb://USER-SERVICE
          predicates:
            - Path=/user-service/**
            - Method=GET
          filters:
            - RemoveRequestHeader=Cookie
            - RewritePath=/user-service/(?<segment>.*), /$\{segment}
            - AuthorizationHeaderFilter
        - id: user-service
          uri: lb://USER-SERVICE
          predicates:
            - Path=/user-service/actuator/**
            - Method=GET,POST
          filters:
            - RemoveRequestHeader=Cookie
            - RewritePath=/user-service/(?<segment>.*), /$\{segment}
        - id: catalog-service
          uri: lb://CATALOG-SERVICE
          predicates:
            - Path=/catalog-service/**
        - id: order-service
          uri: lb://ORDER-SERVICE
          predicates:
            - Path=/order-service/**
        - id: order-service
          uri: lb://ORDER-SERVICE
          predicates:
            - Path=/order-service/actuator/**
            - Method=GET
          filters:
            - RemoveRequestHeader=Cookie
            - RewritePath=/order-service/(?<segment>.*), /$\{segment}
        - id: first-service
          uri: http://localhost:8081/
          predicates:
            - Path=/first-service/**
          filters:
            - AddRequestHeader=first-request, first-request-header2
            - AddResponseHeader=first-response, first-response-header2
        - id: second-service
          uri: http://localhost:8082/
          predicates:
            - Path=/second-service/**
          filters:
            - AddRequestHeader=second-request, second-request-header2
            - AddResponseHeader=second-response, second-response-header2

management:
  endpoints:
    web:
      exposure:
        include: refresh, health, beans, httptrace, busrefresh, info, metrics, prometheus


#token:
#  secret: user_token

'스프링 관련 > 스프링' 카테고리의 다른 글

프레임워크 관련 url 정리 (annotation, reflection, di 등)  (0) 2023.01.17
인프라 관련 url index 정리  (0) 2023.01.16
테스트 (Junit) 관련 포스팅 index 페이지  (0) 2023.01.16
dto  (0) 2023.01.15
exception  (0) 2023.01.15

댓글