작성
·
1.3K
0
안녕하세요. 스프링부트 프로젝트를 아래와 같이 생성하고, DB 정보를 application.yml에 기재하였음에도 아래와 같은 에러가 뜨는데 도저히 해결이 안되네요... 도움 부탁드립니다 ㅠ
Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'org.mariadb.jdbc:mariadb-java-client'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
spring:
datasource:
hikari:
data-source-class-name: org.mariadb.jdbc.Driver
# jdbc-url: jdbc:mysql://127.0.0.1:3306/test?serverTimezone=UTC&characterEncoding=UTF-8
jdbc-url: jdbc:mariadb://localhost:3306/test?characterEncoding=UTF-8&serverTimezone=UTC
username: test
password: 1229
connection-test-query: SELECT 1
답변 1
2
안녕하세요 meegotemp님!
.
데이터소스는 히카리CP와는 별개로 설정을 잡아주셔야 합니다.
제가 토이프로젝트에 쓰는 야물 설정파일을 첨부하오니, 설정부분을 다시 살펴보시기 바랍니다.
.
server:
port: 8080
spring:
datasource:
url: jdbc:mysql://127.0.0.1:3306/doglover?serverTimezone=UTC&characterEncoding=UTF-8
username: ****
password: ****
driver-class-name: org.mariadb.jdbc.Driver
hikari:
pool-name: SpringBootJPAHikariCP
maximum-pool-size: 2
idle-timeout: 10000
connection-timeout: 10000
validation-timeout: 10000
max-lifetime: 28770000
connection-init-sql: set wait_timeout = 600
jpa:
hibernate:
ddl-auto: create
properties:
hibernate:
# default_batch_size: 1000
show_sql: false
format_sql: true
logging:
level:
# root: warn
org.hibernate.SQL: debug
org.hibernate.type: trace
.
감사합니다.
해결되었습니다. 너무 감사합니다!