Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.
Spring Boot
2016-12-22
onozaty
Spring Boot
•
• Play Framework
• Spring
• Play Scala
Scala
Spring Boot
• Spring Framework
• Spring Framework
• Tomcat Jetty
jar(Uber JAR)
• Maven Gradle
• 

( )
Spring Initializr
• Spring Boot
WEB
Spring Initializr
• Project
( Maven Gradle )
• STS(Spring Tool Suite)
Spring Initializr
•
• http://start.spring.io/
Spring Initializr
Spring Initializr
Spring Initializr
Spring Initializr
•
•
Hello World!
Dependencies Web Project
Hello World!
Eclipse “Hello World!!”
package com.example;
import org.springframework.stereotype.Controller;
import org.spr...
Hello World!
Tomcat
• Spring Boot
Spring
• Web Spring MVC
•
• Spring Boot
•
•
• 

https://github.com/spring-projects/spring-boot/tree/
master/spring-boot-samples
AutoConfigure
• Spring Boot AutoConfigure
•
AutoConfigure
AutoConfigure
• Flyway
Flyway
• H2
datasource H2
DB
DB
•
• Spring JDBC
• Spring DATA JPA
• MyBatis Spring
Spring JDBC
• spring-boot-starter-jdbc
• JDBC
(Apache commons DbUtils )
Spring JDBC
@Repository
public class CustomerRepository {
@Autowired
private NamedParameterJdbcTemplate jdbcTemplate;
publ...
Spring DATA JPA
• spring-boot-starter-data-jpa
• JPA
• JPA EntityManager Interface
Spring DATA JPA
@Entity
@Table(name = "customers")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Customer {
@I...
Spring DATA JPA
@Service
public class CustomerService {
@Autowired
private CustomerRepository customerRepository;
public L...
REST API
• CRUD API
• RDBMS H2
• Spring DATA JPA
• Flyway DB
• Swagger
•
• https://github.com/onozaty/spring-boot-sandbox/tree/
master/spring-boot-demo-20161222
• Spring
•
Prochain SlideShare
Chargement dans…5
×

Spring Bootを触ってみた

2 064 vues

Publié le

社内勉強会にてSpring Bootについて発表した資料です。

Publié dans : Technologie
  • Soyez le premier à commenter

  • Soyez le premier à aimer ceci

Spring Bootを触ってみた

  1. 1. Spring Boot 2016-12-22 onozaty
  2. 2. Spring Boot • • Play Framework • Spring • Play Scala Scala
  3. 3. Spring Boot • Spring Framework • Spring Framework
  4. 4. • Tomcat Jetty jar(Uber JAR) • Maven Gradle • 
 ( )
  5. 5. Spring Initializr • Spring Boot WEB
  6. 6. Spring Initializr • Project ( Maven Gradle ) • STS(Spring Tool Suite)
  7. 7. Spring Initializr • • http://start.spring.io/
  8. 8. Spring Initializr
  9. 9. Spring Initializr
  10. 10. Spring Initializr
  11. 11. Spring Initializr • •
  12. 12. Hello World! Dependencies Web Project
  13. 13. Hello World! Eclipse “Hello World!!” package com.example; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @Controller public class HelloController { @RequestMapping("/") @ResponseBody public String hello(){ return "Hello World!!"; } }
  14. 14. Hello World! Tomcat
  15. 15. • Spring Boot Spring • Web Spring MVC •
  16. 16. • Spring Boot • • • 
 https://github.com/spring-projects/spring-boot/tree/ master/spring-boot-samples
  17. 17. AutoConfigure • Spring Boot AutoConfigure • AutoConfigure
  18. 18. AutoConfigure • Flyway Flyway • H2 datasource H2 DB
  19. 19. DB • • Spring JDBC • Spring DATA JPA • MyBatis Spring
  20. 20. Spring JDBC • spring-boot-starter-jdbc • JDBC (Apache commons DbUtils )
  21. 21. Spring JDBC @Repository public class CustomerRepository { @Autowired private NamedParameterJdbcTemplate jdbcTemplate; public List<Customer> findAll() { return jdbcTemplate.query( "SELECT * FROM customers ORDER BY id", new BeanPropertyRowMapper<Customer>(Customer.class)); } public void update(Customer customer) { jdbcTemplate.update( "UPDATE customers SET name = :name, address = :address WHERE id = :id", new BeanPropertySqlParameterSource(customer)); } }
  22. 22. Spring DATA JPA • spring-boot-starter-data-jpa • JPA • JPA EntityManager Interface
  23. 23. Spring DATA JPA @Entity @Table(name = "customers") @Data @AllArgsConstructor @NoArgsConstructor public class Customer { @Id @GeneratedValue private Integer id; private String name; private String address; }
  24. 24. Spring DATA JPA @Service public class CustomerService { @Autowired private CustomerRepository customerRepository; public List<Customer> findAll() { return customerRepository.findAll(); } public List<Customer> findByName(String name) { return customerRepository.findByName(name); } public Customer create(Customer customer) { return customerRepository.save(customer); } @Repository public interface CustomerRepository extends JpaRepository<Customer, Integer> { public List<Customer> findByName(String name); }
  25. 25. REST API • CRUD API • RDBMS H2 • Spring DATA JPA • Flyway DB • Swagger
  26. 26. • • https://github.com/onozaty/spring-boot-sandbox/tree/ master/spring-boot-demo-20161222
  27. 27. • Spring •

×