[ 문제 ]
프로젝트 구성 중 DB를 연동하지 않아 실행 시 아래와 같은 오류 발생
***************************
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).
Process finished with exit code 0
[ 해결법 ]
1. DB 연동
application.yml 파일에 DB 연동 정보 입력
######### 기본 설정 #########
spring:
datasource:
url: #[Database]://localhost:3306/[Database 스키마]#
username: #[DB 아이디]#
password: #[DB password]#
driver-class-name: #[JDBC 드라이버]#
2. 옵션 추가
DB 접속 정보가 없을 시 Application.java 파일에 exclude 옵션 추가
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class})
정상 작동 확인
반응형
'오류 및 해결 > Spring' 카테고리의 다른 글
[Spring] org.springframework.beans.factory.CannotLoadBeanClassException 오류 (0) | 2023.08.25 |
---|---|
Spring Security XML 설정 오류(servlet-context.xml) (0) | 2023.07.24 |
[Spring] localhost:8080 접속 시 로그인 오류 해결 방법 (0) | 2022.04.11 |