Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Spring Boot 소개

32,787 views

Published on

Spring Boot 소개 자료.

Published in: Technology
  • DOWNLOAD THE BOOK INTO AVAILABLE FORMAT (New Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THE can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THE is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBOOK .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, CookBOOK, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, EBOOK, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THE Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THE the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THE Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THE BOOK INTO AVAILABLE FORMAT (New Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THE can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THE is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBOOK .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, CookBOOK, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, EBOOK, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THE Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THE the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THE Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Dating for everyone is here: ❶❶❶ http://bit.ly/2Q98JRS ❶❶❶
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Sex in your area is here: ❶❶❶ http://bit.ly/2Q98JRS ❶❶❶
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Get HERE to Read This eBook === http://zakuratest.com/1903659000-Rugbys-Class-War-Bans-Boot-Money-and-Parliamentary-Battles.htmlhttp://zakuratest.com/
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Spring Boot 소개

  1. 1. Spring Boot 소개 최범균, 2014-12-22
  2. 2. 웹 어플 만들때 필요한 것들 예시 •  Maven •  Spring MVC •  JPA + Spring Data •  JSP •  MySQL •  Tomcat이나 Jetty로 테스트 •  SLF4J + Logback •  JUnit, Spring Test 2  
  3. 3. Boot 이전의 설정: 메이븐 <dependencies>        <dependency>                  <groupId>javax.servlet.jsp</groupId>                  <ar:factId>jsp-­‐api</ar:factId>                  <version>2.2</version>                  <scope>provided</scope>          </dependency>          <dependency>                  <groupId>javax.servlet</groupId>                  <ar:factId>javax.servlet-­‐api</ar:factId>                  <version>3.0.1</version>                  <scope>provided</scope>          </dependency>          <dependency>                  <groupId>javax.servlet</groupId>                  <ar:factId>jstl</ar:factId>                  <version>1.2</version>          </dependency>          <dependency>                  <groupId>org.springframework</groupId>                  <ar:factId>spring-­‐webmvc</ar:factId>                  <version>${spring.version}</version>          </dependency>          <dependency>                  <groupId>org.springframework</groupId>                  <ar:factId>spring-­‐orm</ar:factId>                  <version>${spring.version}</version>          </dependency>          <dependency>                  <groupId>org.hibernate</groupId>                  <ar:factId>hibernate-­‐en:tymanager</ar:factId>                  <version>4.3.7.Final</version>          </dependency>          <dependency>                  <groupId>org.springframework.data</groupId>                  <ar:factId>spring-­‐data-­‐jpa</ar:factId>                  <version>1.7.0.RELEASE</version>          </dependency>    <dependency>                  <groupId>com.mchange</groupId>                  <ar:factId>c3p0</ar:factId>                  <version>0.9.2.1</version>          </dependency>          <dependency>                  <groupId>mysql</groupId>                  <ar:factId>mysql-­‐connector-­‐java</ar:factId>                  <version>5.1.30</version>          </dependency>          <dependency>                  <groupId>org.springframework</groupId>                  <ar:factId>spring-­‐core</ar:factId>                  <version>${spring.version}</version>                  <exclusions>                          <exclusion>                                  <groupId>commons-­‐logging</groupId>                                  <ar:factId>commons-­‐logging</ar:factId>                          </exclusion>                  </exclusions>          </dependency>          <dependency>                  <groupId>org.slf4j</groupId>                  <ar:factId>jcl-­‐over-­‐slf4j</ar:factId>                  <version>1.7.7</version>          </dependency>          <dependency>                  <groupId>ch.qos.logback</groupId>                  <ar:factId>logback-­‐classic</ar:factId>                  <version>1.1.2</version>          </dependency>          <dependency>                  <groupId>junit</groupId>                  <ar:factId>junit</ar:factId>                  <version>4.12</version>                  <scope>test</scope>          </dependency>          <dependency>                  <groupId>org.springframework</groupId>                  <ar:factId>spring-­‐test</ar:factId>                  <version>${spring.version}</version>                  <scope>test</scope>          </dependency>   </dependencies>   <build>          <plugins>                  <plugin>                          <ar:factId>maven-­‐compiler-­‐plugin</ar:factId>                          <version>3.1</version>                          <configura:on>                                  <source>1.8</source>                                  <target>1.8</target>                                  <encoding>uU-­‐8</encoding>                          </configura:on>                  </plugin>                    <plugin>                          <groupId>org.eclipse.jeVy</groupId>                          <ar:factId>jeVy-­‐maven-­‐plugin</ar:factId>                          <version>9.2.6.v20141205</version>                          <configura:on>                                  <webApp>                                          <contextPath>/</contextPath>                                  </webApp>                                  <scanIntervalSeconds>3</scanIntervalSeconds>                          </configura:on>                  </plugin>            </plugins>   </build>   3  
  4. 4. Boot 이전의 설정: 스프링 @EnableJpaRepositories(basePackages  =  "domain")   @EnableWebMvc   @EnableTransac:onManagement   @ComponentScan(basePackages  =  "controller")   public  class  Config  extends  WebMvcConfigurerAdapter  {          @Override          public  void  configureDefaultServletHandling(DefaultServletHandlerConfigurer  configurer)  {                  configurer.enable();          }          @Override          public  void  configureViewResolvers(ViewResolverRegistry  registry)  {                  registry.jsp().prefix("/WEB-­‐INF/view/");          }          @Bean          public  LocalContainerEn:tyManagerFactoryBean  en:tyManagerFactory()  {                  LocalContainerEn:tyManagerFactoryBean  emf  =  new  LocalContainerEn:tyManagerFactoryBean();                  emf.setPackagesToScan("domain");                  emf.setDataSource(dataSource());                  HibernateJpaVendorAdapter  adapter  =  new  HibernateJpaVendorAdapter();                  adapter.setDatabase(Database.MYSQL);                  adapter.setShowSql(true);                  emf.setJpaVendorAdapter(adapter);                  return  emf;          }          @Bean          public  DataSource  dataSource()  {                  ComboPooledDataSource  ds  =  new  ComboPooledDataSource();                  try  {                          ds.setDriverClass("com.mysql.jdbc.Driver");                  }  catch  (PropertyVetoExcep:on  e)  {                          throw  new  Run:meExcep:on(e);                  }                  ds.setJdbcUrl("jdbc:mysql://localhost/test?characterEncoding=uU8");                  ds.setUser("root");                  return  ds;          }          @Bean          public  PlaUormTransac:onManager  transac:onManager(En:tyManagerFactory  emf)  {                  JpaTransac:onManager  tm  =  new  JpaTransac:onManager();                  tm.setEn:tyManagerFactory(emf);                  return  tm;          }   }   4  
  5. 5. Boot 이전의 설정: web.xml <?xml  version="1.0"  encoding="UTF-­‐8"?>   <web-­‐app  xmlns:xsi="hVp://www.w3.org/2001/XMLSchema-­‐instance"                    xmlns="hVp://java.sun.com/xml/ns/javaee"                    xsi:schemaLoca:on="hVp://java.sun.com/xml/ns/javaee              hVp://java.sun.com/xml/ns/javaee/web-­‐app_3_0.xsd"                    version="3.0">            <servlet>                  <servlet-­‐name>dispatcher</servlet-­‐name>                  <servlet-­‐class>                          org.springframework.web.servlet.DispatcherServlet                  </servlet-­‐class>                  <init-­‐param>                          <param-­‐name>contextClass</param-­‐name>                          <param-­‐value>                                  org.springframework.web.context.support.Annota:onConfigWebApplica:onContext                          </param-­‐value>                  </init-­‐param>                  <init-­‐param>                          <param-­‐name>contextConfigLoca:on</param-­‐name>                          <param-­‐value>config.Config</param-­‐value>                  </init-­‐param>                  <load-­‐on-­‐startup>1</load-­‐on-­‐startup>          </servlet>            <servlet-­‐mapping>                  <servlet-­‐name>dispatcher</servlet-­‐name>                  <url-­‐paVern>/</url-­‐paVern>          </servlet-­‐mapping>            <filter>                  <filter-­‐name>encodingFilter</filter-­‐name>                  <filter-­‐class>org.springframework.web.filter.CharacterEncodingFilter</filter-­‐class>                  <init-­‐param>                          <param-­‐name>encoding</param-­‐name>                          <param-­‐value>UTF-­‐8</param-­‐value>                  </init-­‐param>          </filter>          <filter-­‐mapping>                  <filter-­‐name>encodingFilter</filter-­‐name>                  <url-­‐paVern>/*</url-­‐paVern>          </filter-­‐mapping>     </web-­‐app>   5  
  6. 6. 프로젝트 설정 작업 •  따분하고 지루하고 실수하기 딱 좋은 과정 – 의존 모듈 간 버전 맞추기 – (다른 소스에서) 설정 C&P하고 수정 – 잘 되나 테스트 – 빌드와 실행 6  
  7. 7. Boot •  최소한의 노력으로 스프링 기반 프로젝트를 시작할 수 있도록 도와줌 – 스프링 및 연동 기술의 표준화된 버전 설정 – 설정 최소화 : 기술별 표준화된 설정 모음 제공 – 임베디드 서버, 보안, 모니터링 구현 지원 7  
  8. 8. Boot 이후: 설정 <parent>          <groupId>org.springframework.boot</groupId>          <ar:factId>spring-­‐boot-­‐starter-­‐parent</ar:factId>          <version>1.2.0.RELEASE</version>   </parent>   <dependencies>          <dependency>                  <groupId>org.springframework.boot</groupId>                  <ar:factId>spring-­‐boot-­‐starter-­‐web</ar:factId>          </dependency>          <dependency>                  <groupId>org.springframework.boot</groupId>                  <ar:factId>spring-­‐boot-­‐starter-­‐data-­‐jpa</ar:factId>          </dependency>          <dependency>                  <groupId>org.springframework.boot</groupId>                  <ar:factId>spring-­‐boot-­‐starter-­‐test</ar:factId>          </dependency>          <dependency>                  <groupId>mysql</groupId>                  <ar:factId>mysql-­‐connector-­‐java</ar:factId>          </dependency>          <dependency>                  <groupId>javax.servlet</groupId>                  <ar:factId>jstl</ar:factId>          </dependency>          <dependency>                  <groupId>org.springframework.boot</groupId>                  <ar:factId>spring-­‐boot-­‐starter-­‐tomcat</ar:factId>                  <scope>provided</scope>          </dependency>          <dependency>                  <groupId>org.apache.tomcat.embed</groupId>                  <ar:factId>tomcat-­‐embed-­‐jasper</ar:factId>                  <scope>provided</scope>          </dependency>   </dependencies>   <build>          <plugins>                  <plugin>                          <groupId>org.springframework.boot</groupId>                          <ar:factId>spring-­‐boot-­‐maven-­‐plugin</ar:factId>                  </plugin>          </plugins>   </build>   @SpringBootApplica:on   public  class  Applica:on  {            public  sta:c  void  main(String[]  args)  {                  SpringApplica:on.run(Applica:on.class,  args);          }     }   spring.view.prefix:  /WEB-­‐INF/view/   spring.view.suffix:  .jsp     spring.datasource.url=jdbc:mysql://localhost/test?characterEncoding=uU8   spring.datasource.username=root   spring.datasource.password=   spring.datasource.driver=com.mysql.jdbc.Driver     spring.jpa.database=MYSQL   8  
  9. 9. 이전과 이후 비교 9  
  10. 10. Boot가 해 준 것 1, 모듈 설정 <parent>          <groupId>org.springframework.boot</groupId>          <ar:factId>spring-­‐boot-­‐starter-­‐parent</ar:factId>          <version>1.2.0.RELEASE</version>   </parent>     <dependencies>          <dependency>                  <groupId>org.springframework.boot</groupId>                  <ar:factId>spring-­‐boot-­‐starter-­‐web</ar:factId>          </dependency>          <dependency>                  <groupId>org.springframework.boot</groupId>                  <ar:factId>spring-­‐boot-­‐starter-­‐data-­‐jpa</ar:factId>          </dependency>          <dependency>                  <groupId>org.springframework.boot</groupId>                  <ar:factId>spring-­‐boot-­‐starter-­‐test</ar:factId>          </dependency>        <dependency>                  <groupId>org.springframework.boot</groupId>                  <ar:factId>spring-­‐boot-­‐starter-­‐tomcat</ar:factId>                  <scope>provided</scope>          </dependency>          <dependency>                  <groupId>org.apache.tomcat.embed</groupId>                  <ar:factId>tomcat-­‐embed-­‐jasper</ar:factId>                  <scope>provided</scope>          </dependency>   </dependencies>   표준 버전 모음   spring-­‐mvc 등 웹 관련 모듈 자동 설정   spring-­‐data-­‐jpa,  JPA,  Hibernate 관련 모듈 설정   연관된 spring-­‐orm,  커넥션 풀 등 모듈 설정   spring-­‐test,  JUnit  등 관련 모듈 설정   임베디드 톰캣 관련 모듈 설정   10  
  11. 11. 모듈 구성 11  
  12. 12. Boot가 해 준 것 2, 스프링 설정 @SpringBootApplica7on   public  class  Applica:on  {            public  sta:c  void  main(String[]  args)  {                  SpringApplica7on.run(Applica:on.class,  args);          }     }     //  @SpringBootApplica:on은 다음과 동일   //  @Configura:on   //  @EnableAutoConfigura7on   //  @ComponentScan   모든 설정 자동 생성!   - 스프링 MVC   -­‐  DataSource   -­‐  JPA,  JPA  TX,  Spring  Data  JPA   -­‐  DispatcherServlet,  CharacterEncodingFilter   spring.view.prefix:  /WEB-­‐INF/view/   spring.view.suffix:  .jsp     spring.datasource.url=jdbc:mysql://localhost/test?...   spring.datasource.username=root   spring.datasource.password=   spring.datasource.driver=com.mysql.jdbc.Driver     spring.jpa.database=MYSQL   JSP용 ViewResolver 설정   DataSource  설정   JPA 설정   12  
  13. 13. @EnableAutoConfiguration @EnableAutoConfigura:on   @JpaRepositoriesAutoConfigura:on   @HibernateJpaAutoConfigura:on   @EmbeddedServletContainerAutoConfigura:on   @WebMvcAutoConfigura:on   @DataSourceAutoConfigura:on   @OOOOAutoConfigura:on  들   각 AutoConfigura:on은 조건에 따라 기본 설정 생성   13  
  14. 14. Boot가 해 준 것 3, 서버 실행 •  임베디드 톰캣으로 실행 – mvn spring-boot:run ...   [INFO]  -­‐-­‐-­‐  spring-­‐boot-­‐maven-­‐plugin:1.2.0.RELEASE:run  (default-­‐cli)  @  bootVersion  -­‐-­‐-­‐   ...   10:11:57.394  [app.Applica:on.main()]  INFO    app.Applica:on  -­‐  Star:ng  Applica:on  on  MADVIRUSui-­‐MacBook-­‐Air.local  with  PID  15134  (...)   ...   ...   10:11:59.947  [app.Applica:on.main()]  INFO    o.s.b.c.e.t.TomcatEmbeddedServletContainer  -­‐  Tomcat  ini:alized  with  port(s):  8080/hVp   10:12:00.219  [app.Applica:on.main()]  INFO    o.a.catalina.core.StandardService  -­‐  Star7ng  service  Tomcat   10:12:00.221  [app.Applica:on.main()]  INFO    o.a.catalina.core.StandardEngine  -­‐  Star7ng  Servlet  Engine:  Apache  Tomcat/8.0.15   ...   ...   10:12:05.708  [app.Applica:on.main()]  INFO    o.s.b.c.e.t.TomcatEmbeddedServletContainer  -­‐  Tomcat  started  on  port(s):  8080/hIp   10:12:05.712  [app.Applica:on.main()]  INFO    app.Applica:on  -­‐  Started  Applica:on  in  8.702  seconds  (JVM  running  for  12.428)   14  
  15. 15. Boot가 해 준 것 4, 실행 가능 war 생성 •  패키징한 war를 java 명령어로 실행 가능 – mvn package – java -jar target/myapp.war •  임베디드 톰캣으로 실행 •  생성된 war를 일반 WAS에 배포해도 됨 •  war가 아닌 jar 타입으로도 가능 15  
  16. 16. 다양한 기능에 대한 자동 설정 지원 16  
  17. 17. 운영지원 기능 : Actuator •  서비스 상태(Health), 계측(Metric) 등 서비스 운영 지원을 위한 정보 제공 기능 •  다음 의존 추가로 자동 활성화 •  예, /health <dependency>          <groupId>org.springframework.boot</groupId>          <ar:factId>spring-­‐boot-­‐starter-­‐actuator</ar:factId>   </dependency>   17  
  18. 18. Actuator가 제공하는 정보 •  env : 스프링 Environment의 프로퍼티 목록 •  health : 어플리케이션 Health 상태 정보 •  metrics : 계측 정보 •  mappings : 웹 경로 매핑 정보 •  dump : 쓰레드 덤프 •  beans : 빈 목록 정보 •  trace : 최근 HTTP 요청 목록 표시(100개) 18  
  19. 19. 기타 •  Remote Shell 기능 (Telnet로 연결해서 관리) •  기본 로깅 설정 제공 •  NoSQL 지원 (Redis, MongoDB, Solr 등) •  WebSocket 설정 지원 •  JTA 설정 지원 (Atomikos, Bitronix) •  Maven과 Gradle 지원 19  
  20. 20. 참고자료 •  Spring Boot 프로젝트 – http://projects.spring.io/spring-boot/ •  레퍼런스 문서가 좋음 •  도서: Learning Spring Boot – http://goo.gl/Awzzoz •  Gradle 기반 •  현재 버전에 맞게 코드를 수정해야 할 부분이 간혹 있 지만 감을 잡기에 충분한 지식 제공 20  

×