Spring Framework
[오류] Failed to configure a DataSource 해결
터프남
2022. 1. 10. 16:15
728x90
반응형
간단하게 요청테스트만 해보려고 했는데 아래와 같은 에러 발생
사실 요청 테스트는 TEST 코드로 확인할 수도 있지만 잘 몰라서...공부 필요
어쨌든 오류 이유는 스프링부트에서 컨테이너가 최초 기동될 때 자동으로 autoconfigure 파일들을 읽는데 DB의 url이나 id, password, drive-class-name 같은게 설정이 안되있어서 그렇다.
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).
가장 간단하게 해결할 수 있는 방법은 최초 구동 시 DataSourceAutoConfiguration 를 제외 시켜주면 된다.
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
public class SampleApplication {
public static void main(String[] args) {
SpringApplication.run(SampleApplication.class, args);
}
}
728x90
반응형