application.yml 작성 이슈

Crow·2022년 8월 23일
0

삽질

목록 보기
9/16

파일 업로드중 uploadPath패스 설정에 필요해서
application.yml에 설정 추가시 발생함

servlet:
    multipart:
      enabled: true
      location: c:\\upload
      max-request-size: 300MB
      max-file-size: 50MB

여기까진 작성에 문제가 없었음
(이 부분의 최상위 인덴트도 spring:이었기 때문)


com:
github:
  studym:
    studymarathon:
      path: C:\\upload

하지만 이 부분 작성시 문제가 생김

 ***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class


Action:

Consider the following:
  If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
  If you have database settings to be loaded from a particular profile you may need to activate it (the profiles local are currently active).


종료 코드 1(으)로 완료된 프로세스

처음엔 DataSource가 문제가 생긴줄 알아서 확인해봤는대 다 정상이었음 그러다가 발견한 문제는

com:
  github:
    studym:
      studymarathon:
        path: C:\\upload

작성시 인덴트를 잘못설정해서
datasource:의 최상위 인덴트가
spring:인게 아니라 com:인덴트로 바뀌어서 발생했음

before

spring:
 profiles:
   active: local

 servlet:
   multipart:
     enabled: true
     location: c:\\upload
     max-request-size: 300MB
     max-file-size: 50MB

com:
 github:
   studym:
     studymarathon:
       path: C:\\upload

 datasource:
   username: studym
   password: studym
   url: jdbc:mysql://localhost:5000/study_marathon

 jpa:
   open-in-view: false
   hibernate:
     ddl-auto: update
   show-sql: true
   properties:
     hibernate.format_sql: true

 logging:
   file:
     path: c/Log
     max-size: 500MB
     max-history: 10
   level:
     org:
       springframework:
         security:
           web: TRACE
     com:
       github:
         studym:
           studymarathon: debug

 security:
   oauth2:
     client:
       registration:
         google:
           client-id: ${GOOGLE_CLIENT_ID}
           client-secret: ${GOOGLE_CLIENT_SECRET}
           scope:
             - profile
             - email

after

spring:
 profiles:
   active: local

 servlet:
   multipart:
     enabled: true
     location: c:\\upload
     max-request-size: 300MB
     max-file-size: 50MB

 datasource:
   username: ${MYSQL_USER_ID}
   password: ${MYSQL_USER_PW}
   url: jdbc:mysql://localhost:5000/study_marathon

 jpa:
   open-in-view: false
   hibernate:
     ddl-auto: update
   show-sql: true
   properties:
     hibernate.format_sql: true

 logging:
   file:
     path: c/Log
     max-size: 500MB
     max-history: 10
   level:
     org:
       springframework:
         security:
           web: TRACE
     com:
       github:
         studym:
           studymarathon: debug

 security:
   oauth2:
     client:
       registration:
         google:
           client-id: ${GOOGLE_CLIENT_ID}
           client-secret: ${GOOGLE_CLIENT_SECRET}
           scope:
             - profile
             - email

com:
 github:
   studym:
     studymarathon:
       path: C:\\upload

코드는 바꾼게 없고 spring:을 최상위 인덴트로 가지는 설정을 먼저 둔 후 oauth2, file:path 설정을 둬서 해결함

yml을 아무래도 사용한적이 많이 없어서 실수가 많은거 같음

다음부턴 설정을 추가한후
http://www.yamllint.com/ 에서 확인해봐야겠음

profile
어제보다 개발 더 잘하기 / 많이 듣고 핵심만 정리해서 말하기 / 도망가지 말기 / 깃허브 위키 내용 가져오기

0개의 댓글