쌤리

[Spring Boot] 오류: "Failed to configure a DataSource: ‘url’ attribute is not..." 본문

자바 JAVA/Spring | 스프링

[Spring Boot] 오류: "Failed to configure a DataSource: ‘url’ attribute is not..."

saml2l 2020. 8. 18. 20:09

  • 위와 같이 오류 메시지가 나올 때
  • 해결방법:
    • 1. application.yml 파일에 아래와 같이 jdbc driver 관련 설정 추가
 datasource:
    username: at
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://127.0.0.1:3306/at?useUnicode=true&characterEncoding=utf8&autoReconnect=true&serverTimezone=Asia/Seoul&useOldAliasMetadataBehavior=true&zeroDateTimeNehavior=convertToNull
  • 2. db 없이 우선 작업 할 경우 main 에다가 아래 @ 어노테이션을 넣주면 된다
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class, XADataSourceAutoConfiguration.class})

 

Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured. Reason: F

If the spring-boot-starter-data-jpa dependency is added in the spring boot pom.xml file, when the spring boot application starts the exception “Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be con

www.yawintutor.com

 

 

Comments