티스토리 뷰
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured 에러
yun jjang 2018. 11. 29. 18:25스프링 부트 프로젝트를 구동하는데
아래와 같은 에러가 나는 경우가 있다.
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
SpringBoot는 어플리케이션이 시작될 때 필요한 기본 설정들을 자동으로 설정하게 되어있는데,
그중에 DataSource 설정이 자동구성 될 때 필요한 데이터베이스 정보가 설정되지 않아 발생하는 문제다.
프로젝트가 생성될 때 appliction.properties 파일이 자동 생성된 빈파일에
사용자가 원하는 DB 설정을 넣고, 맞는 드라이버와 라이브러리 설치, JDBC 설정을 해야한다는 의미다.
만약 당장 JDBC설정이 필요없고 어떤 DB를 사용할지 결정하지 않았다면 다음의 소스를 참조하면 된다.
어플리케이션파일에
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
어노테이션을 추가한다.
package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
@SpringBootApplication
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
'Java' 카테고리의 다른 글
Intellij로 SpringBoot 게시판 만들기 2 - 기본 실행 텍스트 출력, 뷰 실행 (0) | 2018.11.29 |
---|---|
Intellij로 SpringBoot 게시판 만들기 1 - spring initializr와 gradle로 프로젝트 생성 (0) | 2018.11.28 |
Collection(set, list...) ≒ Map (0) | 2018.11.20 |
예외처리 Exception (0) | 2018.11.20 |
interface (0) | 2018.11.20 |
- Total
- Today
- Yesterday
- Whitelabel Error Page(404 Not Found)에러
- spring 기본 login
- Spring Security
- 패키지 위치 찾기
- webprogramming
- 알고리즘
- eclipse disable welcome page
- 활성화된 파일 위치 찾기
- gradle 종속성
- apache tomcat 설정
- 라이브러리 종속성
- spring loaded
- SQL 개발툴
- tomcat 환경변수
- DB 툴
- login page
- runtimeOnly
- EDAILY CODING CHALLENGE
- springboot에서 jsp호출
- Apache설치
- java
- Autoscroll from Source
- compileOnly
- mysql 연동
- 기초입문
- 웹서버설치
- hot swapping
- 나눔고딕코딩
- 이데일리 코딩 챌린지
- Encoding UTF-8
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |