헤르메스 LIFE

[Spring Boot] IntelliJ로 간단한 Spring Boot 환경 테스트 본문

Spring Boot Framework

[Spring Boot] IntelliJ로 간단한 Spring Boot 환경 테스트

헤르메스의날개 2020. 12. 26. 20:15
728x90

JDK 1.8.x

IntelliJ IDEA 2020.3

 

1. New Project

2. Maven 선택

3. 프로젝트 경로 설정

4. Maven 설정파일 기본 ( pom.xml )

5. Maven 설정파일 수정

- 2.2.4.RELEASE 빨강색 오류남. ( pom.xml >> maven >> Reload Project 하면 사라짐. )

 

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.rest</groupId>
    <artifactId>SimpleRestAPI</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.4.RELEASE</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
        </dependency>

    <!--  빌드 플러그인 -->
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

 

6. Application.java

 

package com.sample;

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

@SpringBootApplication
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

 

7. 실행 ( Shift + F10 )

 

 

8. 실행결과 ( 일단 시작은 됐음. )

 

 

9. 브라우저 실행

 

Web server failed to start. Port 8080 was already in use.

 

※ IntelliJ는 뭔가 옵션이 보여짐. ㅎㅎ

 

 

 

 

728x90