Portfolio/Spring Boot

스프링 부트 3일차 - 인프런 강좌로 다시 시작

Foo 2019. 4. 3. 21:31
728x90

어젠 숙영을 해서 밖에서 잤고.. 오늘도 피곤하고 열도 나는 것 같지만 강의 조금이라도 보고 자려고함.

강좌 내용 자체를 올리는 것은 문제 소지가 있기 때문에 올리지 않고, 강좌를 듣다가 매우매우매우 중요하다고 생각되는것이나 헷갈릴만한 내용만 내 생각대로 정리해보려고 함

강좌 주소 : https://www.inflearn.com/course/%EC%8A%A4%ED%94%84%EB%A7%81%EB%B6%80%ED%8A%B8/

 

스프링부트 - 백기선의 스프링 부트 - 스프링 프레임워크 - 인프런

 

www.inflearn.com

 

 

https://docs.spring.io/spring-boot/docs/2.1.3.RELEASE/reference/htmlsingle/#getting-started-maven-installation

 

Spring Boot Reference Guide

This section dives into the details of Spring Boot. Here you can learn about the key features that you may want to use and customize. If you have not already done so, you might want to read the "Part II, “Getting Started”" and "Part III, “Using Spring Boot

docs.spring.io

에서 https://docs.spring.io/spring-boot/docs/2.1.3.RELEASE/reference/htmlsingle/#getting-started-maven-installation

 

Spring Boot Reference Guide

This section dives into the details of Spring Boot. Here you can learn about the key features that you may want to use and customize. If you have not already done so, you might want to read the "Part II, “Getting Started”" and "Part III, “Using Spring Boot

docs.spring.io

로 이동하여 스프링 부트를 위한 의존성 추가

<!-- Inherit defaults from Spring Boot -->
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.1.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>

 

클래스를 하나 만들어주고

해당 클래스에 다음과 같은 식으로 파일을 만들어주는것만으로도 8080포트로 톰캣이 실행

package me.whiteship;

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);
    }
}

 

그리고 해당 파일을 배포하기 위해 Jar로 만들기 위해선

mvn package를 입력하면 되는데, 윈도우에는 기본으로 포함되어있지않다.

maven을 설치해줘야하는데 다음 사이트 참고

메이븐 설치 : https://printhelloworld.tistory.com/113

 

Maven을 윈도우10에 설치하기

Maven을 윈도우10에 설치하기 Apache Maven은 소프트웨어 프로젝트 관리 툴이다. POM(project object model)의 개념 위에서, Maven은 project의 build와 보고서 만들기나 문서화를 정보의 중앙관리를 통해 관리할..

printhelloworld.tistory.com

 

의존성을 복사해서 붙여넣는 식으로 만들기 싫다면?

Spring Initializr : https://start.spring.io/

에서 스프링 부트 의존성을 추가해서 프로젝트를 생성하여 IDE로 열어줘도 됨

 

그래들을 쓰고 싶은데 강사님께서 메이븐을 쓰시니까 영상 보는 동안은 메이븐을 쓰자 ㅎㅎ