🌿 기본 환경: IDE: STS4, Language: Java

 

 

발생 Error

🚨 SpringBoot에서 Project import 후, application.java 파일 import 구문에 다음과 같은 Error 발생

1
2
import org.springframework.boot.SpringApplication;
 
 
cs

 

 

발생 원인

Gradle Project로 인식되지 않음

 

 

해결 방법

configure → add gradle nature 실행

 

cf. Maven Project

1. C:\Users\사용자이름\.m2 파일 제거
2. 프로젝트 우클릭 - Maven - update project
(* 프로젝트 우클릭 - Maven이 없을 경우: 프로젝트 우클릭 - Configure - Convert to maven project)

 

 

참고 자료

 

JAVA SPRING 환경 구축 설치 하자마자 에러( import org.springframework cannot be resolved )

구글링을 해보니 gradle이 안 가져와져서 뜨는 문제이고 해당 프로젝트 우클릭후 configure -> add gradle nature 실행 또는 maven일 경우 - C:\Users\사용자이름\.m2 파일 제거 프로젝트 우클릭 - Maven - update proj

xorms0707.tistory.com

 

🌿 기본 환경: IDE: STS4, Language: Java

 

 

발생 Error

🚨 SpringBoot에서 Application.java 파일을 SpringBoot App Run을 실행 후,

http://localhost:8080/으로 접속할 경우, 맨 처음 화면이 Whitelabel Error Page가 반환됨

 

 

발생 원인

localhost:8080 으로 연결 시, 기본값인 index.html이 없음

 

 

해결 방법

src/main/webapp에 index.html 파일 생성

 

 

 

참고 자료

 

스프링부트 Whitelabel Error Page 에러 해결방법

프로제트 서버를 실행 한 후 localhost:8080 으로 접속을 해보면 Whitelabel Error Page 에러가 발생하는 경우가 있는데 전체 에러 메시지는 아래와 같다 Whitelabel Error Page This application has no explicit mapping for

wakestand.tistory.com

 

🟦 기본 환경: IDE: IntelliJ, Language: Java

 

 

발생 Error

SpringBoot에서 SpringBoot 3.x대 project import 시, 🚨 다음과 같은 Error 발생

A problem occurred configuring root project 'NewProject'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.1.0.
     Required by:
         project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.1.0
      > No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.1.0 was found.
  The consumer was configured to find a runtime of a library compatible with Java 11, packaged as a jar, and its dependencies declared externally,
  as well as attribute 'org.gradle.plugin.api-version' with value '7.6.1' but:
          - Variant 'apiElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.0 declares a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares an API of a component compatible with Java 17 and the consumer needed a runtime of a component compatible with Java 11

 

 

발생 원인

SpringBoot 3.0 부터는 Java 17부터 지원

 

 

해결 방법

1. SpringBoot를 2.x대로 다운그레이드

2. Java17 설치

  2.1. File / Settings / Build, Execution, Deployment / Build Tools / Gradle 

  : Gradle JVM: Java17 이상으로 설정

  2.2. File / Project Structure / Project

  : SDK - Java 17 이상으로 설정

  : Language level - SDK default로 설정

  2.3. File / Project Structure / Modules

  : Language level - project default로 설정

  2.4. Gradle Refresh

 

 

 

참고 자료

 

Spring Boot 3.x 실행이 안될 경우 (feat. IntelliJ)

스프링 부트 3.0 이 출시되었다. (현재 최신은 3.0.1 이지만) 3.0 부터는 Java 17부터 지원된다. 그러다보니 기존에 Java8, 11등을 사용하시던 분들은 3.x 스프링 부트 프로젝트를 실행할때 에러들을 만나

jojoldu.tistory.com

 

🟦 기본 환경: IDE: IntelliJ, Language: Java

 

 

발생 Error

SpringBoot에서 다음 Source Code를 실행할 경우,

Submit 버튼 클릭 시, 🚨다음과 같은 Error 발생

Request method 'POST' not supported
org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported
at org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping.handleNoMatch(RequestMappingInfoHandlerMapping.java:260)

 

 

발생 원인

button 클릭에 따른 submit action이 취해지는 곳에서 POST방식으로 데이터를 전송하지만 해당 URL을 처리하는 Controller에서 처리되지 않음

+ action이 없는 경우, 폼은 현재 페이지의 URL을 대상으로 데이터를 제출

 

 

해결 방법

관련 Controller에 action 주소 @PostMapping 메서드 추가

 

🟦 기본 환경: IDE: IntelliJ, Language: Java

 

 

발생 Error

SpringBoot에서 다음 Source Code를 실행할 경우,

이름을 입력하지 않고 submit 버튼 클릭 시, 🚨다음과 같은 Error 발생

org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors
Field error in object 'memberForm' on field 'name': rejected value [];

codes [NotEmpty.memberForm.name,NotEmpty.name,NotEmpty.java.lang.String,NotEmpty];

arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [memberForm.name,name];

arguments [];

default message [name]];

default message [회원 이름은 필수입니다.]

 

 

발생 원인

@NotEmpty를 선언한 name field가 공란으로 submit됨

 

 

해결 방법

name field에 값 입력

⭕ name값 미입력 시, Whitelabel Error Page로 이동하는 것이 아닌 입력 필요 안내 문구 Load

 name값 미입력 시, submit 버튼이 클릭될 수 없도록 로직 생성