문제 파악
Spring boot 최초 실행 시 DB 관련 dedependencies 추가 했는데 DB 접속 정보를 추가 하지 않으면 발생하는 오류.
로그 내용
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-11-18 15:37:06.776 ERROR 17616 --- [ restartedMain] 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
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).
해결 방법
build.gradle
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-data-jdbc'
// implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-hateoas'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
// implementation 'org.liquibase:liquibase-core'
// implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.1.4'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'org.postgresql:postgresql'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
testImplementation 'org.springframework.security:spring-security-test'
}
application.yaml 수정
spring:
datasource:
url: jdbc:postgresql://localhost:5432/postgres
username : postgres
password : 1234
driver-class-name: org.postgresql.Driver
'개발(합니다) > 시나브로(이슈)' 카테고리의 다른 글
.idea 폴더, .iml 파일을 gitignore에 추가하자 (1) | 2020.12.15 |
---|---|
[Maven] File not found: META-INF\MANIFEST.MF. (0) | 2020.12.09 |
[git] : remote: HTTP Basic: Access denied (0) | 2019.10.04 |
log4j:WARN No appenders could be found for logger (jdbc.audit). (0) | 2019.01.23 |
Neither BindingResult nor plain target object for bean name 'memberVo' available as request attribute (0) | 2019.01.23 |