IT

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

프로개발러 2022. 11. 23. 15:35
반응형

1)오류 현상

Spring boot 처음 셋팅하고 돌릴 , 아래와 같은 에러가 떨어지고 start 안됨.

 

 

2022-07-21 16:31:11.982 ERROR 16864 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   :

 

 

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

 

 

 

 

2)원인

 

데이터베이스 설정 정보가 없어서 오류가 났음.

'url' attribute is not specified and no embedded datasource could be configured.

 

 

3)해결 방법

 

Resources 디렉토리 밑에 application.properties에다가 database connection 정보를 적어줄 수도 있으나 비추천.

 

가장 빠른 방법은

Main application에다가 아래 어노테이션을 추가

 

@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class })

public class ProjectApplication {

 

public static void main(String[] args) {

SpringApplication.run(ProjectApplication.class, args);

System.out.println("Test");

}

 

}

 

반응형