메모용 개발 블로그
  • Home

Categories

  • All Posts116
  • OS35
    • Linux23
    • MacOS8
    • Windows4
  • 데이터베이스3
    • Oracle1
    • Postgresql1
  • Develop26
    • CSS33
    • Go8
    • HTML52
    • Java1
    • JavaScript4
    • React2
    • Svelte2
  • 개발일기10
  • Docker1
  • Git3
  • GitLab12
  • Nginx7
  • 기타16
  • 이 블로그의 오픈소스3
Develop•2024년 11월 29일

내부 톰캣을 사용하지 않는 IntelliJ IDEA Community Spring Boot 에러

Table of Contents

  • 내부 톰캣을 사용하지 않는 IntelliJ IDEA Community Spring Boot 에러
  • 개요
  • 환경
  • 원인
  • 해결
  • 해결 1 (권장)
  • 해결 2

개요

Spring Boot로 만든 프로젝트가 IntelliJ IDEA Ultimate 버전에서는 잘 되나, Community 버전에서는 아래 오류와 함께 정상 동작하지 않음.

java.lang.IllegalStateException: Error processing condition on org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration.propertySourcesPlaceholderConfigurer

환경

Java: 1.8.0 181

Spring Boot: 2.7,17

배포 시 내부 Tomcat을 사용하지 않는 환경

원인

자동으로 추가되는 설정의 차이로 발생한다.

Add dependencies with "provided" scope to classpath

위 설정이 Spring Boot 실행 설정으로 자동으로 인식되어 추가되는 반면 Community 버전은 그렇지 않다.

Spring boot 내부의 Tomcat(spring-boot-starter-tomcat)은 배포 시 제거하고자 하는 프로젝트이므로 scope가 provided로 설정되어 있다. 그로 인해서 찾지 못해서 발생하는 문제이다.

해결

해결 1 (권장)

Edit Configurations > 사용하는 설정 > Modify options > Add dependencies with "provided" scope to classpath

이후 OK를 눌러 적용시킨다.

해결 2

내부 톰캣의 스코프를 변경하는 방법이다. 배포와 개발 사이의 의존성 스코프가 달라지므로 권장하지 않음.

pom.xml 파일의 spring-boot-starter-tomcat의 scope를 compile로 변경 (기존: provided)

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-tomcat</artifactId>
    <scope>compile</scope>
</dependency>
← Back to all posts