Advertisement
Advertisement

More Related Content

Advertisement

Recently uploaded(20)

Advertisement

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
  25. Spring camp 2014 감사합니다.
Advertisement