Spring Boot 프로젝트 생성하기

이상민·2021년 9월 8일
0

스프링

목록 보기
1/9
post-thumbnail

Spring Boot 이전에는 빌드툴로 프로젝트를 생성하고, 설정파일을 직접 수정해야했다

  • Spring Boot CLI 또는 Spring initializr 통해 간편하게 프로젝트를 생성할 수 있다


Spring Boot CLI

$ spring init --build maven -j 16 -g com.group -a some-artifact-name -n my-project -x my-project
# init : 스프링 프로젝트 생성
# --build : 빌드툴 선택
# -j : 자바 버전 선택 
# -g : 그룹 이름 지정
# -a : artifact 이름 지정
# -n : 프로젝트명 지정 
# -x : 프로젝트 압축을 풀 폴더 이름 지정 

  • init의 실행 결과를 보면 https://start.spring.io 서비스를 사용하는 것을 볼 수 있다. CLI가 아닌 해당 서비스로 직접 프로젝트를 생성할 수도 있다

  • spring help init 명령어로 가능한 모든 옵션을 확인할 수 있다


Spring initializr

스프링 프로젝트 생성을 위한 웹앱. 위의 init 명령어와 동일하게 설정을 줘 프로젝트를 생성할 수 있다

  • 웹앱으로 GUI를 제공하기 때문에 명령어를 잘 몰라도 편하게 사용할 수 있다


인텔리제이 IDEA Spring initializr

IDEA에서도 start.spring.io 서비스를 통해 프로젝트를 생성할 수 있다


spring-boot-starter와 spring-boot-starter-test

  • 스프링부트 프로젝트 생성 시 기본적으로 spring-boot-starter와 spring-boot-starter-test 의존성이 추가된다
	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>
  • 이 두 스타터만으로 다음과 같은 의존성을 가져온다

profile
편하게 읽기 좋은 단위의 포스트를 추구하는 개발자입니다

0개의 댓글