SlideShare a Scribd company logo
참을수 없는 가벼움
Spring Boot
SK Planet
정성용M
SK Planet
정성용
자기 소개
정성용
Spring camp 2014
bungubbang57@gmail.com
!
SK Planet (2012 ~ )
Commerce Platform팀
공채 1기
Spring Boot - Goal Spring camp 2014
・ 모든 스프링개발을 정말 빠르고 다양한방법으로 시작할수 있도록 한다.
・ 부트 그대로 바로 사용할수도, 자신의 목적에 맞춰 다양하게 활용할 수도
있게 한다.
・ 어플리케이션의 기능적 요소 뿐만 아니라 임베디드 서버, 시큐리티, 헬스
체크, 외부 설정 연계등 개발의 모든 사이클을 제공한다.
・ 설정을 위해 Code Generation을 하지 않으며, XML이 필요하지도
않다.
Spring Boot 특징 Spring camp 2014
1. 어플리케이션 로직에 집중 할 수 있도록 과감하게 모든 설정을 없애버렸다.
2. Bean 중심의 설계를 바꿔 놓았다.
・ 설정을 변경하기 위해 Bean을 선언 하는것 뿐만 아니라 Property로 원하는 부분만 변
경 가능하다.
3. 스프링 개발의 지침서가 될 수 있다.
・ 스프링 메인 개발자들이 어떤 프로젝트를 장려하는지 어떻게 설정하고 활용하는지 boot
소스를 보면서 많은 참고를 할 수 있다.
Spring Boot Spring camp 2014
누가 사용 하면 좋을까요?
- 스프링을 완전 처음 시작하시는 분
- Boot 라이브러리 소스를 직접 파헤쳐 볼 수 있으신 분
!
어떤 상황에서 사용 하면 좋을까요?
- 익숙하지 않는 Spring 모듈을 사용할때
- 스프링으로 시작하는 모든 프로젝트
- 소규모 프로젝트에만 적용가능한건 오해
- 빠르지만 무한한 확장성이 장점
Spring Boot Example Spring camp 2014
Spring MVC

Spring Data JPA

Thymeleaf

Logback
Junite
웹 프로젝트 시작하기
with @EnableAutoConfiguration
Example Spring camp 2014
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.0.2.RELEASE</version>
</parent>
Pom.xml
<dependencies>
<dependency> // 개별 dependency 선언
<artifactId>spring-boot-starter-data-jpa</artifactId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
<artifactId>spring-boot-starter-web</artifactId>
<artifactId>hsqldb</artifactId>
</dependency>
<dependencies>
Example Spring camp 2014
Domain
People
Repository
PeopleRepository
Controller
PeopleApiController
ThymeLeafController
Boot
BootSampleApplication
Example Spring camp 2014
@Entity // 일반적인 JPA Entity 설정
public class People {
@Id
@GeneratedValue
private Integer id;
!
private String name;
private Integer age;
// Constructor, Getter, Setter …
}
Example Spring camp 2014
@Repository // 일반적인 JpaRepository 설정
public interface PeopleRepository
extends JpaRepository<People, Integer> {
}
Example Spring camp 2014
@RestController // 일반적인 Controller 설정
@RequestMapping(value = "people")
public class PeopleApiController {
!
@Autowired PeopleRepository peopleRepository;
!
@RequestMapping(method = RequestMethod.GET)
public List<People> peopleList() {
return peopleRepository.findAll();
}
// POST, PUT, DELETE
}
Example Spring camp 2014
@ComponentScan
@EnableAutoConfiguration // 단 하나의 Boot 설정 !
public class BootSampleApplication {
public static void main(String[] args) throws Exception {
SpringApplication
.run(BootSampleApplication.class, args);
}
}
Spring Boot Spring camp 2014
본격적인 Spring-Boot 소개
Spring Boot Spring camp 2014
빌드 시스템 (Java 1.6+)
Gradle, Maven, Ant
핵심 기능
Core Features
SpringApplication | External Configuration | Profiles | Logging
Web Application
MVC | Embedded Containers
Working with data
SQL | NO-SQL
Testing
Overview | Boot Applications | Utils
Extending
Auto-configuration | @Conditions
Spring Boot Spring camp 2014
Property Configuration
1. @PropertySource 설정
2. Java system, OS properties
3. Command Line arguments
4. application.properties (YAML포함)
- 위치 : /config, classpath:, classpath:/config
- profile : application-{profile}.properties
!
우선순위
Command Line > System properties
> @PropertySource > application.properties
!
참고 링크
http://docs.spring.io/spring-boot/docs/current/reference/
htmlsingle/#common-application-properties
Spring Boot Spring camp 2014
Boot Application Starter
spring-boot-starter-amqp
spring-boot-starter-aop
spring-boot-starter-batch
spring-boot-starter-data-jpa
spring-boot-starter-data-mongo
spring-boot-starter-data-rest
spring-boot-starter-integration
spring-boot-starter-jdbc
spring-boot-starter-mobile
spring-boot-starter-redis
spring-boot-starter-security
spring-boot-starter-test
spring-boot-starter-thymeleaf
spring-boot-starter-web
spring-boot-starter-websocket
spring-boot-starter-actuator
spring-boot-starter-remote-shell
spring-boot-starter-jetty
spring-boot-starter-log4j
spring-boot-starter-logging
spring-boot-starter-tomcat
Spring Boot Spring camp 2014
Actuator
- 스프링 어플리케이션을 조작하거나 상태를 알게 해주는 starter
/autoconfig 자동 설정되거나 설정되지 않는 목록들과 그 이유들
/beans 어플리케이션에서 선언한 Bean 목록
/configprops Properties 로 선언된 목록들
/dump Thread dump
/env 시스템 환경 및 어플리케이션 환경 설정 목록
/health 어플리케이션 상태 체크
/info 어플리케이션 정보
/metrics 어플리케이션의 매트릭스 정보
/mappings 어플리케이션의 매핑 정보
/shutdown 어플리케이션 종료
/trace 어플리케이션 접속 정보
Spring Boot Spring camp 2014
Spring MVC
!
1. 기본 설정
- Bean : ContentNegotiatingViewResolver, BeanNameViewResolver,
HttpMessageConverters(JSON, XML) …
- filter : HiddenHttpMethodFilter, WebRequestTraceFilter …
2. Resource
- /static, /public, /resources, /META-INF/resources in classpath
- favicon.ico 도 기본 지원
3. View template지원
- Thymeleaf, freemarker, velocity, groovy-templates
- 기본 폴더 : classpath:/templates/
Spring Boot Spring camp 2014
Logging
!
1. Log4J와 Logback 지원
- spring-boot-start-log4j (Log4J)
- spring-boot-start-logging (Logback)
2. 기본적으로 rotating, 10Mb file size
3. spring-starter-web 는 기본적으로 Logback 지원
- temp/spring.log
- application.properties의 logging.path로 변경 가능
- logback.xml 설정 가능
- 기본이 INFO, --debug로 수정 가능
Spring Boot Spring camp 2014
Servlet Container
!
1. Embedded
- Tomcat7, Jetty
2. Properties 설정
-server.port
-server.address
-server.sessionTimeout
3. extends EmbeddedServletContainerCustomizer
4. @Bean EmbeddedServletContainerFactory
Spring Boot Spring camp 2014
Database
!
1. Embedded database support
- H2, HSQL, Derby (dependency에 추가만)
2. Properties 설정
spring.datasource.url=jdbc:sql://localhost/test
spring.datasource.username=dbuser
spring.datasource.password=dbpass
spring.datasource.driverClassName=com.sql.driver
!
3. @Bean DataSource
Spring Boot Spring camp 2014
spring-data-jpa
1. Properties 설정
- spring.jpa.hibernate.ddl-auto: create-drop
- spring.jpa.generate-ddl: false
- spring.jpa.show-sql: true
!
2. 초기 데이터 설정
- import.sql, schema.sql
- flyway, Liquibase 지원
spring-data-mongo
- spring.data.mongodb.host=mongoserver
- spring.data.mongodb.port=27017
Spring Boot Spring camp 2014
Testing
!
1. spring-boot-starter-test
- scope: test
- MVC test, Junit, Hamcrest, Mockito
- @SpringApplicationConfiguration
Spring Boot
Spring camp 2014
ver 1.0.2
Spring camp 2014
감사합니다.

More Related Content

PDF
Spring boot 공작소(1-4장)
PDF
스프링캠프 2016 발표 - Deep dive into spring boot autoconfiguration
PPTX
Spring boot-summary(part2-part3)
PDF
실전! 스프링과 함께하는 환경변수 관리 변천사 발표자료
PPTX
스프링군살없이세팅하기(The way to setting the Spring framework for web.)
PDF
Spring boot 5장 cli
PDF
spring.io를 통해 배우는 spring 개발사례
PPTX
Spring boot actuator
Spring boot 공작소(1-4장)
스프링캠프 2016 발표 - Deep dive into spring boot autoconfiguration
Spring boot-summary(part2-part3)
실전! 스프링과 함께하는 환경변수 관리 변천사 발표자료
스프링군살없이세팅하기(The way to setting the Spring framework for web.)
Spring boot 5장 cli
spring.io를 통해 배우는 spring 개발사례
Spring boot actuator

What's hot (20)

PDF
Express 프레임워크
PDF
Resource Handling in Spring MVC
PDF
Spring Boot 2
PDF
자바 웹 개발 시작하기 (3주차 : 스프링 웹 개발)
PDF
Spring Boot 1
PPTX
Spring 웹 프로젝트 시작하기
PDF
overview of spring4
PDF
Spring camp 발표자료
PDF
okspring3x
PDF
Spring 4.x Web Application 살펴보기
PDF
20131217 html5
PDF
[오픈소스컨설팅]Spring MVC
PDF
파크히어 Realm 사용 사례
PPT
Spring MVC
PDF
자바 웹 개발 시작하기 (2주차 : 인터넷과 웹 어플리케이션의 이해)
PDF
03.실행환경 교육교재(배치처리)
PPTX
SpringMVC 전체 흐름 알아보기
PDF
Springcamp spring boot intro
PDF
Open source APM Scouter로 모니터링 잘 하기
PDF
자바 웹 개발 시작하기 (6주차 : 커뮤니티를 만들어보자!)
Express 프레임워크
Resource Handling in Spring MVC
Spring Boot 2
자바 웹 개발 시작하기 (3주차 : 스프링 웹 개발)
Spring Boot 1
Spring 웹 프로젝트 시작하기
overview of spring4
Spring camp 발표자료
okspring3x
Spring 4.x Web Application 살펴보기
20131217 html5
[오픈소스컨설팅]Spring MVC
파크히어 Realm 사용 사례
Spring MVC
자바 웹 개발 시작하기 (2주차 : 인터넷과 웹 어플리케이션의 이해)
03.실행환경 교육교재(배치처리)
SpringMVC 전체 흐름 알아보기
Springcamp spring boot intro
Open source APM Scouter로 모니터링 잘 하기
자바 웹 개발 시작하기 (6주차 : 커뮤니티를 만들어보자!)
Ad

Viewers also liked (10)

PPTX
PPTX
소프트웨어 개발자 로드맵
PDF
TDD.JUnit.조금더.알기
PPTX
자동화된 Test Case의 효과
PPT
목 오브젝트(Mock Object)의 이해
PPTX
Maven의 이해
PDF
Spring boot 를 적용한 전사모니터링 시스템 backend 개발 사례
PDF
스프링 부트와 로깅
PDF
Spring Boot 소개
PDF
Okjsp 13주년 발표자료: 생존 프로그래밍 Test
소프트웨어 개발자 로드맵
TDD.JUnit.조금더.알기
자동화된 Test Case의 효과
목 오브젝트(Mock Object)의 이해
Maven의 이해
Spring boot 를 적용한 전사모니터링 시스템 backend 개발 사례
스프링 부트와 로깅
Spring Boot 소개
Okjsp 13주년 발표자료: 생존 프로그래밍 Test
Ad

Similar to Spring-Boot (springcamp2014) (20)

PDF
백기선의 스프링 부트
PDF
2023.05.22 발표 자료 : 스프링 부트 기초
PPTX
Spring boot
PPT
Share some development
PDF
(스프링프레임워크 강좌)스프링부트개요 및 HelloWorld 따라하기
PDF
Spring vs. spring boot
PPTX
Springmvc
PPTX
Spring boot DI
PPTX
2022 백엔드 멘토링 자료
PDF
Spring Boot 기초 코드랩 (2019-10-26)
PDF
2023.06.12 발표 자료 : JPA / 스프링 구조
PDF
Spring boot + java 에코시스템 #1
PPTX
KSUG 스프링캠프 2017 발표자료
PPTX
Spring Boot + React + Gradle in VSCode
PPTX
[월간 슬라이드] 한시간안에 게시판 만들기 with 스프링부트
PPTX
NCS기반 Spring Framework & MyBatis_ 스프링프레임워크 & 마이바티스 ☆무료강의자료 제공/ 구로오라클학원, 탑크리에...
PPTX
NCS기반 Spring Framework & MyBatis_ 스프링프레임워크 & 마이바티스 ☆무료강의자료 제공/ 구로오라클학원, 탑크리에...
PPTX
스프링!=스프링부트
PDF
Spring3 발표자료 - 김연수
PDF
(자바교육/스프링교육/스프링프레임워크교육/마이바티스교육추천)#2.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)
백기선의 스프링 부트
2023.05.22 발표 자료 : 스프링 부트 기초
Spring boot
Share some development
(스프링프레임워크 강좌)스프링부트개요 및 HelloWorld 따라하기
Spring vs. spring boot
Springmvc
Spring boot DI
2022 백엔드 멘토링 자료
Spring Boot 기초 코드랩 (2019-10-26)
2023.06.12 발표 자료 : JPA / 스프링 구조
Spring boot + java 에코시스템 #1
KSUG 스프링캠프 2017 발표자료
Spring Boot + React + Gradle in VSCode
[월간 슬라이드] 한시간안에 게시판 만들기 with 스프링부트
NCS기반 Spring Framework & MyBatis_ 스프링프레임워크 & 마이바티스 ☆무료강의자료 제공/ 구로오라클학원, 탑크리에...
NCS기반 Spring Framework & MyBatis_ 스프링프레임워크 & 마이바티스 ☆무료강의자료 제공/ 구로오라클학원, 탑크리에...
스프링!=스프링부트
Spring3 발표자료 - 김연수
(자바교육/스프링교육/스프링프레임워크교육/마이바티스교육추천)#2.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)

Spring-Boot (springcamp2014)

  • 1. 참을수 없는 가벼움 Spring Boot SK Planet 정성용M SK Planet 정성용
  • 2. 자기 소개 정성용 Spring camp 2014 bungubbang57@gmail.com ! SK Planet (2012 ~ ) Commerce Platform팀 공채 1기
  • 3. Spring Boot - Goal Spring camp 2014 ・ 모든 스프링개발을 정말 빠르고 다양한방법으로 시작할수 있도록 한다. ・ 부트 그대로 바로 사용할수도, 자신의 목적에 맞춰 다양하게 활용할 수도 있게 한다. ・ 어플리케이션의 기능적 요소 뿐만 아니라 임베디드 서버, 시큐리티, 헬스 체크, 외부 설정 연계등 개발의 모든 사이클을 제공한다. ・ 설정을 위해 Code Generation을 하지 않으며, XML이 필요하지도 않다.
  • 4. Spring Boot 특징 Spring camp 2014 1. 어플리케이션 로직에 집중 할 수 있도록 과감하게 모든 설정을 없애버렸다. 2. Bean 중심의 설계를 바꿔 놓았다. ・ 설정을 변경하기 위해 Bean을 선언 하는것 뿐만 아니라 Property로 원하는 부분만 변 경 가능하다. 3. 스프링 개발의 지침서가 될 수 있다. ・ 스프링 메인 개발자들이 어떤 프로젝트를 장려하는지 어떻게 설정하고 활용하는지 boot 소스를 보면서 많은 참고를 할 수 있다.
  • 5. Spring Boot Spring camp 2014 누가 사용 하면 좋을까요? - 스프링을 완전 처음 시작하시는 분 - Boot 라이브러리 소스를 직접 파헤쳐 볼 수 있으신 분 ! 어떤 상황에서 사용 하면 좋을까요? - 익숙하지 않는 Spring 모듈을 사용할때 - 스프링으로 시작하는 모든 프로젝트 - 소규모 프로젝트에만 적용가능한건 오해 - 빠르지만 무한한 확장성이 장점
  • 6. Spring Boot Example Spring camp 2014 Spring MVC
 Spring Data JPA
 Thymeleaf
 Logback Junite 웹 프로젝트 시작하기 with @EnableAutoConfiguration
  • 7. Example Spring camp 2014 <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.0.2.RELEASE</version> </parent> Pom.xml <dependencies> <dependency> // 개별 dependency 선언 <artifactId>spring-boot-starter-data-jpa</artifactId> <artifactId>spring-boot-starter-thymeleaf</artifactId> <artifactId>spring-boot-starter-web</artifactId> <artifactId>hsqldb</artifactId> </dependency> <dependencies>
  • 8. Example Spring camp 2014 Domain People Repository PeopleRepository Controller PeopleApiController ThymeLeafController Boot BootSampleApplication
  • 9. Example Spring camp 2014 @Entity // 일반적인 JPA Entity 설정 public class People { @Id @GeneratedValue private Integer id; ! private String name; private Integer age; // Constructor, Getter, Setter … }
  • 10. Example Spring camp 2014 @Repository // 일반적인 JpaRepository 설정 public interface PeopleRepository extends JpaRepository<People, Integer> { }
  • 11. Example Spring camp 2014 @RestController // 일반적인 Controller 설정 @RequestMapping(value = "people") public class PeopleApiController { ! @Autowired PeopleRepository peopleRepository; ! @RequestMapping(method = RequestMethod.GET) public List<People> peopleList() { return peopleRepository.findAll(); } // POST, PUT, DELETE }
  • 12. Example Spring camp 2014 @ComponentScan @EnableAutoConfiguration // 단 하나의 Boot 설정 ! public class BootSampleApplication { public static void main(String[] args) throws Exception { SpringApplication .run(BootSampleApplication.class, args); } }
  • 13. Spring Boot Spring camp 2014 본격적인 Spring-Boot 소개
  • 14. Spring Boot Spring camp 2014 빌드 시스템 (Java 1.6+) Gradle, Maven, Ant 핵심 기능 Core Features SpringApplication | External Configuration | Profiles | Logging Web Application MVC | Embedded Containers Working with data SQL | NO-SQL Testing Overview | Boot Applications | Utils Extending Auto-configuration | @Conditions
  • 15. Spring Boot Spring camp 2014 Property Configuration 1. @PropertySource 설정 2. Java system, OS properties 3. Command Line arguments 4. application.properties (YAML포함) - 위치 : /config, classpath:, classpath:/config - profile : application-{profile}.properties ! 우선순위 Command Line > System properties > @PropertySource > application.properties ! 참고 링크 http://docs.spring.io/spring-boot/docs/current/reference/ htmlsingle/#common-application-properties
  • 16. Spring Boot Spring camp 2014 Boot Application Starter spring-boot-starter-amqp spring-boot-starter-aop spring-boot-starter-batch spring-boot-starter-data-jpa spring-boot-starter-data-mongo spring-boot-starter-data-rest spring-boot-starter-integration spring-boot-starter-jdbc spring-boot-starter-mobile spring-boot-starter-redis spring-boot-starter-security spring-boot-starter-test spring-boot-starter-thymeleaf spring-boot-starter-web spring-boot-starter-websocket spring-boot-starter-actuator spring-boot-starter-remote-shell spring-boot-starter-jetty spring-boot-starter-log4j spring-boot-starter-logging spring-boot-starter-tomcat
  • 17. Spring Boot Spring camp 2014 Actuator - 스프링 어플리케이션을 조작하거나 상태를 알게 해주는 starter /autoconfig 자동 설정되거나 설정되지 않는 목록들과 그 이유들 /beans 어플리케이션에서 선언한 Bean 목록 /configprops Properties 로 선언된 목록들 /dump Thread dump /env 시스템 환경 및 어플리케이션 환경 설정 목록 /health 어플리케이션 상태 체크 /info 어플리케이션 정보 /metrics 어플리케이션의 매트릭스 정보 /mappings 어플리케이션의 매핑 정보 /shutdown 어플리케이션 종료 /trace 어플리케이션 접속 정보
  • 18. Spring Boot Spring camp 2014 Spring MVC ! 1. 기본 설정 - Bean : ContentNegotiatingViewResolver, BeanNameViewResolver, HttpMessageConverters(JSON, XML) … - filter : HiddenHttpMethodFilter, WebRequestTraceFilter … 2. Resource - /static, /public, /resources, /META-INF/resources in classpath - favicon.ico 도 기본 지원 3. View template지원 - Thymeleaf, freemarker, velocity, groovy-templates - 기본 폴더 : classpath:/templates/
  • 19. Spring Boot Spring camp 2014 Logging ! 1. Log4J와 Logback 지원 - spring-boot-start-log4j (Log4J) - spring-boot-start-logging (Logback) 2. 기본적으로 rotating, 10Mb file size 3. spring-starter-web 는 기본적으로 Logback 지원 - temp/spring.log - application.properties의 logging.path로 변경 가능 - logback.xml 설정 가능 - 기본이 INFO, --debug로 수정 가능
  • 20. Spring Boot Spring camp 2014 Servlet Container ! 1. Embedded - Tomcat7, Jetty 2. Properties 설정 -server.port -server.address -server.sessionTimeout 3. extends EmbeddedServletContainerCustomizer 4. @Bean EmbeddedServletContainerFactory
  • 21. Spring Boot Spring camp 2014 Database ! 1. Embedded database support - H2, HSQL, Derby (dependency에 추가만) 2. Properties 설정 spring.datasource.url=jdbc:sql://localhost/test spring.datasource.username=dbuser spring.datasource.password=dbpass spring.datasource.driverClassName=com.sql.driver ! 3. @Bean DataSource
  • 22. Spring Boot Spring camp 2014 spring-data-jpa 1. Properties 설정 - spring.jpa.hibernate.ddl-auto: create-drop - spring.jpa.generate-ddl: false - spring.jpa.show-sql: true ! 2. 초기 데이터 설정 - import.sql, schema.sql - flyway, Liquibase 지원 spring-data-mongo - spring.data.mongodb.host=mongoserver - spring.data.mongodb.port=27017
  • 23. Spring Boot Spring camp 2014 Testing ! 1. spring-boot-starter-test - scope: test - MVC test, Junit, Hamcrest, Mockito - @SpringApplicationConfiguration
  • 24. Spring Boot Spring camp 2014 ver 1.0.2