inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

스프링부트에서 MariaDB 연동 관련 에러

1435

henry

작성한 질문수 9

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

스프링부트 jpa

답변 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

.

감사합니다.

0

henry

해결되었습니다. 너무 감사합니다!

코드 질문

0

8

0

To-Do App

0

16

0

twitterdb 연결이 안돼요

1

24

2

@JsonIgnore 이후 Internal Server Error가 발생하지 않습니다.

0

32

2

changeTeam 메서드 질문

0

34

1

테스트 관련 질문!

0

49

2

안녕하세요 질문있습니다.

0

46

2

application.properties가 적용되지 않아요

1

67

3

새 프로젝트 속 제너레이터에 SpringBoot가 없습니다.

0

52

2

설정 정보 없이 임베디드 데이터베이스 생성

0

37

1

OrderServiceTest 상문주문 테스트 시 update 쿼리 문의

0

40

1

N+1 관련해서 질문있습니다.

0

89

3

벌크연산에서 member.getAge 호출 시 영속성 컨텍스트에서 데이터를 가져오는건가요?

0

54

2

inheritance startegy 선택시 고려사항

0

35

1

Entity 동등성 비교

0

38

1

패키지 구분에 대해 궁금한게 있습니다

0

46

2

스프링부트 서버 에러나요

0

33

1

RepositoryTest의 패키지 위치가 domain인 이유

0

57

2

도메인 모델에서 관계와 규칙을 구분하는 방법

0

79

2

16 강의 메세지 retryCount의 의도

0

45

2

JPA Repository 질문이 있습니다!

1

56

2

페이지네이션 처리를 쿼리에서 하는 방식 질문

1

47

1

UserService, CertificationService 책임 분리 기준 질문

0

37

1

실무 조언 관련 질문입니다.

0

64

1