Just Do IT!
[Error] Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. 본문
개발 공부/Error
[Error] Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
MOON달 2025. 3. 4. 11:50728x90
반응형
실습을 위한 프로젝트 생성 중,
application.yaml 파일에서 SQL 설정을 해주었는데 아래와 같은 오류가 나왔다.
이는
에러가 발생하는 이유는 Database에 연결할 때 필요한 정보가 없기 때문이다.
그런데 나는 제대로 작성했는데 왜 안되는지 고민했는데,
아주 사소한 부분이지만 중요한 부분을 수정해야 했었다.
spring:
jpa:
show-sql: true
properties:
format_sql: true
dialect: org.hibernate.dialect.MySQLDialect
hibernate:
ddl-auto: validate
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/user
username:
password:
이렇게 간단한 부분이었는데,
tab을 제대로 안한 내 잘못이었다.
들여쓰기로 계층을 구분하는데, jpa와 datasource가 같은 계층으로 되어야 제대로 작동함을 알 수 있었다.
이런 걸 잘 생각하고 환경 설정을 해야겠다.
728x90
'개발 공부 > Error' 카테고리의 다른 글
양방향 매핑 제대로 하기 (0) | 2025.03.25 |
---|---|
Query did not return a unique result: 2 results were returned 오류 해결 (0) | 2025.03.21 |
Spring Boot 3 버전에서 Swagger UI 접속 시 404 에러가 발생할 때 (0) | 2025.02.28 |
[warning] Serializing PageImpl instances as-is is not supported 경고 발생 (3) | 2024.10.25 |
[Error] Unsatisfied dependency expressed through constructor parameter 0 에러 (0) | 2024.10.23 |