Slide 1

Slide 1 text

Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Intro to Spring Boot Stéphane Nicoll, Pivotal inc. @snicoll Brian Clozel, Pivotal inc. @brianclozel

Slide 2

Slide 2 text

https://start.spring.io

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

Adding a simple REST Controller @RestController public class HomeController { @RequestMapping("/") public String home() { return "Hello GDG DevFest!"; } }

Slide 5

Slide 5 text

Spring Boot starters org.springframework.boot spring-boot-starter-data-jpa org.springframework.boot spring-boot-starter-data-rest § Adding here spring-data-jpa (interact with a JPA datastore) § and spring-data-rest (expose hypermedia resources) § Starters bring recommended dependencies and trigger autoconfiguration

Slide 6

Slide 6 text

Writing an Hypermedia repository @Repository public interface SpeakerRepository extends CrudRepository { @RestResource(path = "by-twitter") Speaker findByTwitter(@Param("id") String twitter); Collection findByLastName(String lastName); }

Slide 7

Slide 7 text

http://localhost:8080/speakers/search

Slide 8

Slide 8 text

http://localhost:8080/speakers/

Slide 9

Slide 9 text

Adding Spring Boot Security Starter org.springframework.boot spring-boot-starter-security

Slide 10

Slide 10 text

In-Memory Authentication with Spring Security @Configuration static class SecurityConfig extends GlobalAuthenticationConfigurerAdapter { @Override public void init(AuthenticationManagerBuilder auth) throws Exception { auth.inMemoryAuthentication() .withUser("hero").password("hero").roles("HERO", "USER").and() .withUser("user").password("user").roles("USER"); } }

Slide 11

Slide 11 text

https://projects.spring.io/spring-boot
 https://spring.io/video Spring Boot