Spring Boot 프로젝트도 생성하고 JDK도 설치하고 DB도 설치했다...

근데 에러가뜬다...

이유는 

 

Description:

기술:


Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
데이터 소스를 구성하지 못했습니다. 'url'속성이 지정되지 않았으며 포함 된 데이터 소스를 구성 할 수 없습니다.


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.

임베디드 데이터베이스 (H2, HSQL 또는 Derby)를 원하면 클래스 경로에 넣으십시오.


If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).

특정 프로필에서로드 할 데이터베이스 설정이있는 경우 활성화해야 할 수 있습니다 (현재 활성화 된 프로필 없음).

 

라고한다...(구글 번역)

 

뭐 하여튼... 빨간색이 중요하다.

Spring Boot 추가 설정을 해줘야 하는것..

 

여기 보이는 application.properties에 

DB연결 설정을 해주자.

spring.datasource.hikari.maximum-pool-size=10
spring.datasource.url=jdbc:postgresql://localhost:5432/postgres
spring.datasource.username=postgres
spring.datasource.password=1234

오라클이던 mysql이던 구글링하면 나오니 알아서 찾아 써넣자.

 

저장하고 다시 하면 잘된다.

 

인터넷 주소창에 localhost:8080 에 접속 후 요런페이지가 뜨면 완료

 

 

github.com/brettwooldridge/HikariCP

 

brettwooldridge/HikariCP

光 HikariCP・A solid, high-performance, JDBC connection pool at last. - brettwooldridge/HikariCP

github.com

자세한 설정을 원하는 경우 HikariCP를 확인해보자

(커넥션풀에 대해서도 찾아보자...)

 

 

 

첫 실행시

SpringApplication.run(RestfulTesterApplication.class, args);

부분에 에러가 난다면..

 

import를 누르고 실행을 하려는데..

 

JDK가 없는것이다..

쉽게말해 JAVA를 설치 안해놓은것

 

www.oracle.com/java/technologies/javase-downloads.html

오라클 홈페이지에서 다운 받은 후 설치하고 적용시키면 된다.

 

 

적용 방법은...

프로젝트 클릭 후 F12를 누르거나

제일 밑에 보이는 Open Moduel Settings를 누르고

 

SDKs 탭에서 Add JDK 하면 된다.

 

Add JDK를 해도 계속 빨간색으로 에러가 뜨는데..

노란 전구를 클릭해서 Setup JDK 누른 후 1.8 선택하면 된다...

 

실행 성공...

 

 

 

Intellij community 2020.3.2 버전 설치 시

기본 plug in에 Spring Boot를 찾아볼 수 없다.

Spring Boot 없음...

plug in이 없어도 Spring Boot 프로젝트를 생성하는 간단한 방법이 있는데...

start.spring.io/

에서

 

스프링 부트 기본설정

자잘한 설정 후 GENERATE 클릭을 하면 .zip 파일이 다운로드된다.

[Artifact].zip file을 압축 해제 후

 

File -> Open 에서 압축 해제된 프로젝트를 열기만 하면 된다.

우측 하단 import를 누르면 완료.

 

spring boot 세팅 완료

 

 

실행은 이곳에서...

+ Recent posts