본문 바로가기
소프트웨어 개발/JAVA

[Spring boot - 스프링부트] Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

by 인생은즐겁게 2022. 12. 3.
반응형

오류

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

 

원인

application.properties 파일에 데이터베이스 연결 설정을 하지 않아서 오류가 발생됨

해결 방법은 application.properties 연결 설정을 하거나 DataSourceAutoConfiguration 클래스를 제외하면 됨

 

 

해결

@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}) 코드 추가로 해결 하였음
지금 당장 데이터베이스 연결 작업을 하려면 DataSourceAutoConfiguration 클래스를 제외하고 작업하면 됨
 
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
@SpringBootApplication
public class CustomErrorApplication {

	public static void main(String[] args) {
		SpringApplication.run(CustomErrorApplication.class, args);
	}

}
반응형

댓글