몇 가지 간단한 단계로 IntelliJ IDEA에서 첫 번째 Spring Boot HelloWorld 응용 프로그램을 만드는 방법은 무엇입니까?
게시 됨: 2020-08-18Hello 독자 – 이 튜토리얼에서는 단 몇 번의 클릭으로 첫 번째 매우 간단한 Hello World Spring Boot 애플리케이션을 만드는 방법에 대한 단계 목록을 살펴보겠습니다.
언젠가 Eclipse에서 첫 번째 Spring Boot 애플리케이션을 생성하는 방법에 대한 기사를 작성한 적이 있습니다. 이클립스 IDE에서 만들고자 하시는 분들은 참고하시기 바랍니다.
Apache Tomcat 및 기타 애플리케이션 서버 없이 애플리케이션을 실행하는 것이 매우 간단하기 때문에 스프링 부트 애플리케이션 사용이 지난 몇 년 동안 많이 증가했습니다.
다음 튜토리얼에서는 포트 8081에서 수신 대기하는 간단한 Spring Boot 웹 애플리케이션을 만들 것입니다.
시작하자.
1 단계.
- IntelliJ IDEA 열기
- 파일을 클릭하십시오
- 새로 만들기를 클릭하십시오
- 프로젝트 클릭
2 단계.
- IntelliJ IDEA –
Spring Initializr
로 Spring Boot 애플리케이션 생성 - 다음 클릭
3단계.
- 아래와 같이 프로젝트 세부 정보 제공
- 그룹:
com.crunchify
- 유물: 스프링부트
- 패키지:
com.crunchify.springboot
- Java 버전: 13 또는 14(설치된 JDK 바이너리)
- 다음 클릭
4단계.
- Spring Boot 애플리케이션에 대한 모든 종속성을 선택하십시오.
- 이 프로젝트에 대한 종속성을 선택하지 않았습니다.
- 다음 클릭
5단계.
- IntelliJ IDEA에 새 Spring Boot 애플리케이션이 생성됩니다.
- 파일 열기: SrpingBootApplication.java
- 일부 정보 메시지를 인쇄하도록 수정
아래 내용을 복사하여 붙여넣습니다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
package com . crunchify . springboot ; import org . springframework . boot . SpringApplication ; import org . springframework . boot . autoconfigure . SpringBootApplication ; /** * @author Crunchify.com * 1st Spring Hello World Application in Intellij IDEA by Crunchify.com * Version: 1.0 */ @ SpringBootApplication public class SpringbootApplication { public static void main ( String [ ] args ) { SpringApplication . run ( SpringbootApplication . class , args ) ; System . out . println ( "\n Hello. This is 1st Spring Hello World Application in Intellij IDEA by Crunchify.com" ) ; } } |
6단계. 프로젝트 빌드
- 왼쪽 패널에서 프로젝트 springboot를 마우스 오른쪽 버튼으로 클릭
- 빌드 모듈 'springboot'를 클릭합니다.
아래와 같이 성공적인 빌드 메시지가 표시되어야 합니다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
Clearing build system data . . . Executing pre - compile tasks . . . Loading Ant Configuration . . . Running Ant Tasks . . . Cleaning output directories . . . Running 'before' tasks Checking sources Copying resources . . . [ springboot ] Parsing java . . . [ springboot ] Writing classes . . . [ springboot ] Updating dependency information . . . [ springboot ] Adding @ NotNull assertions . . . [ springboot ] Adding pattern assertions . . . [ springboot ] Parsing java . . . [ tests of springboot ] Writing classes . . . [ tests of springboot ] Updating dependency information . . . [ tests of springboot ] Adding @ NotNull assertions . . . [ tests of springboot ] Adding pattern assertions . . . [ tests of springboot ] Running 'after' tasks javac 14.0.2 was used to compile java sources Finished , saving caches . . . Executing post - compile tasks . . . Loading Ant Configuration . . . Running Ant Tasks . . . Synchronizing output directories . . . 8 / 17 / 20 , 12 : 11 PM - Build completed successfully in 2 s 236 ms |
7단계. 자바 프로그램 실행
- Java 파일 SpringbootApplication을 마우스 오른쪽 버튼으로 클릭하고 실행하십시오.
- 성공적인 결과를 봐야 합니다
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
/ Library / Java / JavaVirtualMachines / jdk - 14.0.2.jdk / Contents / Home / bin / java - XX : TieredStopAtLevel = 1 - noverify - Dspring . output . ansi . enabled = always - Dcom . sun . management . jmxremote - Dspring . jmx . enabled = true - Dspring . liveBeansView . mbeanDomain - Dspring . application . admin . enabled = true - javaagent : / Applications / IntelliJ IDEA . app / Contents / lib / idea_rt . jar = 53480 : / Applications / IntelliJ IDEA . app / Contents / bin - Dfile . encoding = UTF - 8 - classpath / Users / appshah / crunchify / intellij / springboot / target / classes : / Users / appshah / . m2 / repository / org / springframework / boot / spring - boot - starter / 2.3.3.RELEASE / spring - boot - starter - 2.3.3.RELEASE.jar : / Users / appshah / . m2 / repository / org / springframework / boot / spring - boot / 2.3.3.RELEASE / spring - boot - 2.3.3.RELEASE.jar : / Users / appshah / . m2 / repository / org / springframework / spring - context / 5.2.8.RELEASE / spring - context - 5.2.8.RELEASE.jar : / Users / appshah / . m2 / repository / org / springframework / spring - aop / 5.2.8.RELEASE / spring - aop - 5.2.8.RELEASE.jar : / Users / appshah / . m2 / repository / org / springframework / spring - beans / 5.2.8.RELEASE / spring - beans - 5.2.8.RELEASE.jar : / Users / appshah / . m2 / repository / org / springframework / spring - expression / 5.2.8.RELEASE / spring - expression - 5.2.8.RELEASE.jar : / Users / appshah / . m2 / repository / org / springframework / boot / spring - boot - autoconfigure / 2.3.3.RELEASE / spring - boot - autoconfigure - 2.3.3.RELEASE.jar : / Users / appshah / . m2 / repository / org / springframework / boot / spring - boot - starter - logging / 2.3.3.RELEASE / spring - boot - starter - logging - 2.3.3.RELEASE.jar : / Users / appshah / . m2 / repository / ch / qos / logback / logback - classic / 1.2.3 / logback - classic - 1.2.3.jar : / Users / appshah / . m2 / repository / ch / qos / logback / logback - core / 1.2.3 / logback - core - 1.2.3.jar : / Users / appshah / . m2 / repository / org / apache / logging / log4j / log4j - to - slf4j / 2.13.3 / log4j - to - slf4j - 2.13.3.jar : / Users / appshah / . m2 / repository / org / apache / logging / log4j / log4j - api / 2.13.3 / log4j - api - 2.13.3.jar : / Users / appshah / . m2 / repository / org / slf4j / jul - to - slf4j / 1.7.30 / jul - to - slf4j - 1.7.30.jar : / Users / appshah / . m2 / repository / jakarta / annotation / jakarta . annotation - api / 1.3.5 / jakarta . annotation - api - 1.3.5.jar : / Users / appshah / . m2 / repository / org / springframework / spring - core / 5.2.8.RELEASE / spring - core - 5.2.8.RELEASE.jar : / Users / appshah / . m2 / repository / org / springframework / spring - jcl / 5.2.8.RELEASE / spring - jcl - 5.2.8.RELEASE.jar : / Users / appshah / . m2 / repository / org / yaml / snakeyaml / 1.26 / snakeyaml - 1.26.jar : / Users / appshah / . m2 / repository / org / slf4j / slf4j - api / 1.7.30 / slf4j - api - 1.7.30.jar com . crunchify . springboot . SpringbootApplication Java HotSpot ( TM ) 64 - Bit Server VM warning : Options - Xverify : none and - noverify were deprecated in JDK 13 and will likely be removed in a future release . . ____ _ __ _ _ / \ \ / ___ '_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | ' _ | '_| | ' _ \ / _ ` | \ \ \ \ \ \ / ___ ) | | _ ) | | | | | | | ( _ | | ) ) ) ) ' | ____ | . __ | _ | | _ | _ | | _ \ __ , | / / / / ========= | _ | ============== | ___ /=/ _ / _ / _ / : : Spring Boot : : ( v2 . 3.3.RELEASE ) 2020 - 08 - 17 12 : 12 : 29.554 INFO 70969 --- [ main ] c . c . springboot . SpringbootApplication : Starting SpringbootApplication on LM - AUN - 11022307 with PID 70969 ( / Users / appshah / crunchify / intellij / springboot / target / classes started by appshah in / Users / appshah / crunchify / intellij / springboot ) 2020 - 08 - 17 12 : 12 : 29.556 INFO 70969 --- [ main ] c . c . springboot . SpringbootApplication : No active profile set , falling back to default profiles : default 2020 - 08 - 17 12 : 12 : 29.772 INFO 70969 --- [ main ] c . c . springboot . SpringbootApplication : Started SpringbootApplication in 0.385 seconds ( JVM running for 0.728 ) Hello . This is 1st Spring Hello World Application in Intellij IDEA by Crunchify . com Process finished with exit code 0 |
축하합니다. Spring Boot 애플리케이션을 성공적으로 생성했습니다.

다음은?
- 포트 8081에서 수신 대기하는 가장 간단한 웹 레스트 서비스를 만듭니다.
- Eclipse IDE에서 Spring Boot를 생성합니다.