본문 바로가기
프로그래밍/Spring-boot

스프링부트 강좌 내용 정리 - 0. 스트링 부트 시작하기

by __EunQ 2020. 9. 30.

백기선의 스트링부트 

스프링부트는 스프링 기반의 애플리케이션을 만들 때 빠르고 쉽게 만들어준다.

설정 또한 많이 사용되는 항목을 자동으로 설정해준다.

톰캣 라이브러리 제공

 

프로젝트 생성 후

pom.xml에 spring boot를 부모로 설정

starter-web 의존성 추가

maven-plugin 의존성 추가 

reimport 필요

<!-- Inherit defaults from Spring Boot -->
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.0.3.RELEASE</version>
	</parent>

	<!-- Add typical dependencies for a web application -->
	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>
	</dependencies>

	<!-- Package as an executable jar -->
	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>

java디렉토리 내 패키지 아래 클래스(ex.Application) 만들고

스프링부트 어플리케이션 생성

@SpringBootApplication
public class Application {

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

 

또는 

 

start.spring.io/

 

 

메인 애플리케이션의 위치는 /main/java/기본 패키지에 만들어줌.