새프로젝트 생성 세팅

Untitled

build.gradle 기본 세팅

plugins {
    id 'java'
    id 'org.springframework.boot' version '2.7.10'
    id 'io.spring.dependency-management' version '1.0.15.RELEASE'
}

group = 'com.spring'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    compileOnly 'org.projectlombok:lombok'
    annotationProcessor 'org.projectlombok:lombok'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'

    //jsp 라이브러리 추가
    implementation 'javax.servlet:jstl'
    implementation 'org.apache.tomcat.embed:tomcat-embed-jasper'
}

tasks.named('test') {
    useJUnitPlatform()
}

Main.java

package com.study.springstudy;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Main {
    public static void main(String[] args) {

        SpringApplication.run(Main.class, args);
    }
}

이렇게 초기 세팅하면 톰캣이 정상적으로 돌아가야 하는데 아래와 같은 오류가 생겨 해결 과정

📌📌 action: identify and stop the process that's listening on port 8080 or configure this application to listen on another port.

<aside> ✅ 이미 8080 포트는 사용 중이어서 충돌이 난다는 것이다. application.properties*server.port* = 8000 사용할 포트 번호를 따로 작성해두면 충돌이 사라지며 정상 작동된다.

</aside>

결과 : 아래와 같은 폴더와 파일 구조가 된다.

Untitled