dev_beomgeun
꾸준하게 차근차근
dev_beomgeun
전체 방문자
오늘
어제
  • 분류 전체보기 (170)
    • 전공 (0)
      • 운영체제 (0)
      • 알고리즘 (0)
      • 자료구조 (0)
      • 데이터베이스 (0)
      • 네트워크 (0)
    • 개발 공부 (32)
      • 웹 (6)
      • 리눅스 (4)
      • 머신러닝 (1)
      • 스프링 (17)
      • Git (2)
      • AWS (2)
    • 개발 도서, 강의 (3)
      • 스프링 입문을 위한 자바 객체지향의 원리와 이해 (0)
      • 모든 개발자를 위한 HTTP 웹 기본 지식(김영한.. (2)
      • 스프링 부트와 AWS로 혼자 구현하는 웹서비스 (1)
    • 문제 풀이 (118)
      • 백준 알고리즘 (72)
      • 프로그래머스 알고리즘, SQL (38)
      • Hackerrank SQL (8)
    • 프로젝트 기록 (4)
      • 캡스톤 종합설계 (4)
      • 반려하루 프로젝트 (0)
    • 활동 기록 (12)
      • 네이버 부스트캠프 (7)
      • 취준 & 코테 (4)
      • 소프트웨어 마에스트로 13기 (1)
    • 이것저것 (1)

블로그 메뉴

  • 홈
  • 깃허브
  • 링크드인
  • 방명록

공지사항

인기 글

태그

  • 백준
  • dp
  • 그래프탐색
  • 스프링
  • BFS
  • 프로그래머스
  • 회고
  • 프로그래머스 SQL
  • 반성
  • 서블릿
  • 백준 DP
  • Hackerrank
  • 기록
  • c++
  • AI Tech
  • 일기
  • 네이버 부스트캠프
  • 부스트캠프
  • Baekjoon
  • HackerRank mysql

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
dev_beomgeun

꾸준하게 차근차근

개발 공부/스프링

[SpringBoot] Error - Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

2022. 2. 4. 00:37
728x90

상황

Spring Initializr을 통해서 MySQL 의존성을 추가한 상태

 

IndexController를 테스트용으로 만들고, 서버를 run 시켰더니 마주친 오류

 

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

 

해법 : 위에 써져있듯이, 데이터베이스 의존성만 추가하고 세팅을 하지 않아서 발생한 문제이다.

 

따라서 application.properties에 DataSource에 대한 내용을 적어주면 된다.

 

# MySQL8 설정
spring.datasource.url=jdbc:mysql://localhost:3306/스키마명?useSSL=false&characterEncoding=UTF-8&serverTimezone=UTC
spring.datasource.username=아이디
spring.datasource.password=비밀번호
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

나는 mysql을 사용하기에 mysql 세팅을 해주었다.

 

+ application.properties에 rds 같은 외부 저장소 내용을 세팅할 시

꼭 .gitignore에 application.properties를 추가해줘야 한다.

728x90
저작자표시 비영리 변경금지 (새창열림)

'개발 공부 > 스프링' 카테고리의 다른 글

[SpringBoot] Error - Parameter 0 of constructor in ~ required a bean of type 'java.lang.String' that could not be found.  (3) 2022.06.26
[SpringBoot] Error - java.net.SocketTimeoutException at PlainSocketImpl  (0) 2022.03.12
스프링 - 의존 관계 주입 방법 4가지  (0) 2021.09.17
스프링 - @Component와 컴포넌트 스캔  (0) 2021.09.17
스프링 - 스프링 컨테이너, 싱글톤  (0) 2021.09.17
    '개발 공부/스프링' 카테고리의 다른 글
    • [SpringBoot] Error - Parameter 0 of constructor in ~ required a bean of type 'java.lang.String' that could not be found.
    • [SpringBoot] Error - java.net.SocketTimeoutException at PlainSocketImpl
    • 스프링 - 의존 관계 주입 방법 4가지
    • 스프링 - @Component와 컴포넌트 스캔
    dev_beomgeun
    dev_beomgeun
    백엔드 개발을 하며 얻은 지식과 경험을 공유합니다. 현재 카카오페이에서 백엔드 엔지니어로 일하고 있습니다.

    티스토리툴바