DolphaGo / TIL

TIL & issues
0 stars 1 forks source link

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

Open DolphaGo opened 2 years ago

DolphaGo commented 2 years ago

SpringBoot initializer로 생성 후 서버 기동시

***************************
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).

와 같은 Action이 주어진다.

나같은 경우엔 생성시 의존성에 data-jpa를 넣어놓고, db를 정보를 입력하지 않아서 생긴 문제.

appilcation.yml이나 properties에 db 정보를 입력해준다.

application.properties과 mysql을 예로 들면

spring.datasource.url=jdbc:mysql://localhost:3306/[DB스키마명]?autoReconnect=true
spring.datasource.username=[DB접속Id]
spring.datasource.password=[DB접속Password]
spring.datasource.driver-class-name=com.mysql.jdbc.Driver

이런 과정도 아직 계획에 없다면 data-jpa 라이브러리를 잠시 빼두거나 임시 DB로 h2를 추가해주면 된다.

implementation 'com.h2database:h2'
sgaurav37533 commented 2 years ago

Hi could you assign me this issue @DolphaGo