Failed to configure a DataSource 에러
Failed to configure a DataSource
스프링(부트) 프레임워크를 사용하다 발생한 에러,
발생한 이유는 Database에 연결에 필요한 정보가 없기 때문.
***************************
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 (no profiles are currently active).
찾아보니 프로젝트를 구성하는 초기나, application.properties
파일이나 application.yml
파일의 삭제 혹은 옮김으로서 자주 발생할 수 있는 에러라고 함.
해결방법은 스프링 프로젝트 전반에 필요한 정보를 남아내는, application.properties
파일 혹은 application.yml
파일에 데이터베이스 환경요소를 등록하여 연동시키면 된다.
application.properties
spring.datasource.url=jdbc:[Database]://localhost:3306/[Database스키마] spring.datasource.username=[DB 아이디] spring.datasource.password=[DB 비밀번호] spring.datasource.driver-class-name=[JDBC 드라이버]
application.yml
spring: datasource: url: jdbc:[Database]://localhost:3306/[Database스키마] username: [DB 아이디] password: [DB 비밀번호] driver-class-name: [JDBC 드라이버]
- 참고로 이런 어플리케이션 설정은 yml로 작성하는 추세인것 같다.
Author And Source
이 문제에 관하여(Failed to configure a DataSource 에러), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://velog.io/@developyoun/Failed-to-configure-a-DataSource-에러저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)