#jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

103
What's new in Spring Framework 4.3/Boot 1.4 + Pivotal's Cloud Native Approach 2016/05/21 JJUG CCC 2016 Spring Toshiaki Maki (@making) Sr. Solutions Architect @Pivotal #jjugccc #cccgh5

Transcript of #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Page 1: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

What's  new  in  Spring  Framework  4.3/Boot  1.4  

+Pivotal's Cloud  Native Approach

2016/05/21  JJUG  CCC  2016  SpringToshiaki  Maki  (@making)Sr.  Solutions  Architect  @Pivotal#jjug_̲ccc #ccc_̲gh5

Page 2: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Who  am  I  ?•Toshiaki  Maki  (@making)•https://blog.ik.am•Sr.  Solutions  Architect•Spring  Framework  enthusiast

SpringFramework徹底⼊入⾨門(Coming  Soon?)

パーフェクトJava  EE(Coming  Soon?)

Page 3: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Agenda•Spring  Boot  1.4  /  Spring  Framework  4.3•Spring  Framework  5.0•Spring  Cloud•Go  to  Cloud  Native

Page 4: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Spring  Boothttps://twitter.com/phillip_̲webb/status/641444531867680768

Page 5: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Spring  Initializr https://start.spring.io/

Page 6: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Spring  Initializr https://start.spring.io/

Page 7: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Spring  Initializr https://start.spring.io/

Page 8: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Spring  Boot  Adoption

Page 9: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

RoadmapSpring  Framework

Spring  Boot

2016  JUN 2017〜~

4.3  GA

1.4  GA

5.0  RC1

2.0  GA

5.0  M1 5.0  GA

Page 10: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Spring  Boot  1.4•Banner  Update•Test  Improvements•Spring  Framework  4.3  Support•Misc

https://github.com/spring-‐‑‒projects/spring-‐‑‒boot/wiki/Spring-‐‑‒Boot-‐‑‒1.4-‐‑‒Release-‐‑‒Notes

Page 11: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Spring  Boot  1.4•Banner  Update•Test  Improvements•Spring  Framework  4.3  Support•Misc

https://github.com/spring-‐‑‒projects/spring-‐‑‒boot/wiki/Spring-‐‑‒Boot-‐‑‒1.4-‐‑‒Release-‐‑‒Notes

Page 12: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Spring  Boot  with  Banner

👈

Page 13: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Spring  Boot  with  Banner

src/main/resrouces/banner.txt

•1.1  supported  Custom  Text  Banner  

Page 14: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Spring  Boot  with  Banner•1.3  supported  ANSI  Color  Banner  

${AnsiColor.BRIGHT_GREEN}My Application ${AnsiColor.BRIGHT_YELLOW}Hello!!${AnsiColor.DEFAULT}

src/main/resrouces/banner.txt

Page 15: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

IntelliJ IDEA's  Support

Page 16: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Nyan Cat!

https://github.com/snicoll-‐‑‒demos/spring-‐‑‒boot-‐‑‒4tw-‐‑‒uni/blob/master/spring-‐‑‒boot-‐‑‒4tw-‐‑‒web/src/main/resources/banner.txt

https://ja.wikipedia.org/wiki/Nyan_̲Cat

Page 17: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Spring  Boot  with  Banner•1.4  supports  Image  Banner!!

Page 18: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Spring  Boot  with  Banner•1.4  supports  Image  Banner!!

src/main/resrouces/banner.png

Page 19: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Spring  Boot  with  Banner•1.4  supports  Image  Banner!!

src/main/resrouces/banner.png

Page 20: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Tweetyour  banner

#tweetbootbanner

Page 21: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Spring  Boot  1.4•Banner  Update•Test  Improvements•Spring  Framework  4.3  Support•Misc

https://github.com/spring-‐‑‒projects/spring-‐‑‒boot/wiki/Spring-‐‑‒Boot-‐‑‒1.4-‐‑‒Release-‐‑‒Notes

Page 22: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Test  Improvements•Test  simplifications•Mocking  and  spying•Testing  application  slices

Page 23: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Test  simplifications

@RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(MyApp.class) @WebIntegrationTest(randomPort=true)public class MyTest {

TestRestTemplate rest = new RestTemplate();@Value("${local.server.port}") int port;@Testpublic test() {rest.getForObject("http://localhost:"+port+"/foo",

String.class);}

}

~∼  Spring  Boot  1.3

Page 24: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Test  simplifications

@RunWith(SpringRunner.class) @SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT)public class MyTest {

TestRestTemplate rest = new RestTemplate();@LocalServerPort int port;@Testpublic test() {rest.getForObject("http://localhost:"+port+"/foo",

String.class);}

}

Spring  Boot  1.4  ~∼

Page 25: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Test  simplifications

@RunWith(SpringRunner.class) @SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT)public class MyTest {

TestRestTemplate rest = new RestTemplate();@LocalServerPort int port;@Testpublic test() {rest.getForObject("http://localhost:"+port+"/foo",

String.class);}

}

Spring  Boot  1.4  ~∼• WebEnvironment.DEFINED_PORT• WebEnvironment.MOCK

Page 26: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Test  simplifications

@RunWith(SpringRunner.class) @SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT)public class MyTest {

@AutowiredTestRestTemplate rest;

@Testpublic test() {rest.getForObject("/foo", String.class);

}}

Spring  Boot  1.4  ~∼

equals  tohttp://localhost:${local.server.port}

Page 27: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Mocking  and  spying

@RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(MyApp.class) @WebIntegrationTest(randomPort=true)public class MyTest {

@Autowired FooController fooController;@Testpublic test() {FooService fooService = mock(FooService.class);fooController.fooService = fooService;// stubbing behaviors

}}

~∼  Spring  Boot  1.3

Page 28: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Mocking  and  spying

@RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(MyApp.class) @WebIntegrationTest(randomPort=true)public class MyTest {

@MockBean // or @SpyBeanFooService fooService;

public test() {// stubbing behaviors

}}

Spring  Boot  1.4  ~∼

Mocks  will  be  automatically  reset  across  tests

Page 29: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Testing  application  slices•Testing  the  JPA  slice•Testing  the  Spring  MVC  slice•Testing  the  JSON  slice

for  fast  tests(without  Embedded  Server)

Page 30: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Testing  the  JPA  slice@RunWith(SpringRunner.class)@DataJpaTestpublic class UserRepositoryTests {

@Autowired TestEntityManager em;@Autowired UserRepository repository;

@Testpublic void test() {em.persist(new User("maki", 20));User user = this.repository.findByUsername("maki"); assertThat(user.getUsername()).isEqualTo("maki");assertThat(user.getAge()).isEqualTo(20);}

}

Test  data  creation

Page 31: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Testing  the  Spring  MVC  slice@RunWith(SpringRunner.class) @WebMvcTest(FooController.class)public class FooControllerTests {

@Autowired MockMvc mvc;@MockBean FooService fooService;

@Test public void test() {given(fooService.getFoo("xyz")).willReturn("bar");mvc.perform(get("/foo")

.andExpect(status().isOk())

.andExpect(content().string("bar"));}

}

Page 32: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Testing  the  Spring  MVC  slice@RunWith(SpringRunner.class) @WebMvcTest(FooController.class)public class FooControllerTests {

@Autowired WebClient webClient; // using HtmlUnit@MockBean FooService fooService;

@Test public void test() {given(fooService.getFoo("xyz")).willReturn("bar");HtmlPage page = webClient.getPage("/foo");HtmlForm form = page.getHtmlElementById("fooForm");// ...

} }

Page 33: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Testing  the  Spring  MVC  slice

@RunWith(SpringRunner.class) @WebMvcTest(FooController.class)public class FooControllerTests {

@Autowired WebDriver webDriver; // using Selenium@MockBean FooService fooService;

@Test public void test() {given(fooService.getFoo("xyz")).willReturn("bar");// ...

} }

Page 34: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Testing  the  JSON  slice@RunWith(SpringRunner.class)@JsonTestpublic class MyJsonTests {

JacksonTester<VehicleDetails> json;@Test public void testSerialize() {VehicleDetails details =

new VehicleDetails("Honda", "Civic");assertThat(json.write(details))

.isEqualToJson("expected.json"); assertThat(json.write(details))

.extractingJsonPathStringValue("@.make")

.isEqualTo("Honda");}

}

Page 35: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Testing  the  JSON  slice@RunWith(SpringRunner.class)@JsonTestpublic class MyJsonTests {

JacksonTester<VehicleDetails> json;@Test public void testDeserialize() {String json =

"{¥"make¥":¥"Ford¥",¥"model¥":¥"Focus¥"}"; assertThat(json.parse(json))

.isEqualTo(new VehicleDetails("Ford", "Focus")); assertThat(json.parseObject(json).getMake())

.isEqualTo("Ford"); }

}

Page 36: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Spring  Boot  1.4•Banner  Update•Test  Improvements•Spring  Framework  4.3  Support•Misc

https://github.com/spring-‐‑‒projects/spring-‐‑‒boot/wiki/Spring-‐‑‒Boot-‐‑‒1.4-‐‑‒Release-‐‑‒Notes

Page 37: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Spring  Framework  4.3• Last  4.x  feature  release!• 4.3  RC1:  April  6th• 4.3  GA:  June  1st,  2016

• DI  &  MVC  refinements• Composed  annotations• Extended  support  life  until  2020• on  JDK  6,  7,  8  (and  JDK  9  on  a  best-‐‑‒effort  basis)• on  Tomcat  6,  7,  8.0,  8.5  (and  on  best-‐‑‒effort  9.0)• on  WebSphere  7,  8.0,  8.5  and  9  (Classic  +  Liberty)

from  Keynote  @  Spring  IO  2016

Page 38: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Spring  Framework  4.3• Implicit  constructor  injection• InjectionPoint like  CDI• ....

• Composed  annotations  for  @RequestMapping• Composed  annotations  for  web  @Scopes• @SessionAttribute/@RequestAttribute ...

http://docs.spring.io/spring/docs/4.3.0.RC2/spring-‐‑‒framework-‐‑‒reference/htmlsingle/#new-‐‑‒in-‐‑‒4.3

Core

Web

Page 39: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Implicit  constructor  injection

@RestControllerpublic class FooController {

private final FooService fooService;

@Autowiredpublic FooController(FooService fooService) {this.fooService = fooService;

}}

~∼ Spring  4.2

👈

Page 40: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Implicit  constructor  injection

@RestControllerpublic class FooController {

private final FooService fooService;

public FooController(FooService fooService) {this.fooService = fooService;

}}

Spring  4.3  ~∼

👍

Page 41: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Implicit  constructor  injection

@RestController@AllArgsConstructor(onConstructor = @_(@Autowired)) public class FooController {

private final FooService fooService;}

~∼  Spring  4.2  +  Lombok

👇😩

Page 42: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Implicit  constructor  injection

@RestController@AllArgsConstructorpublic class FooController {

private final FooService fooService;}

Spring  4.3  ~∼  +  Lombok

👍

Page 43: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

InjectionPoint like  CDI

@RestControllerpublic class FooController {

@Autowired@Xyz("bar")FooService service;

}

Page 44: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

InjectionPoint like  CDI@Configurationpublic class FooConfig {

@BeanFooService foo(InjectionPoint ip) {AnnotatedElement elm

= ip.getAnnotatedElement();Xyz xyz = elm.getAnnotation(Xyz.class);String value = xyz.value(); // "bar"// create FooService using Xyz's value

}}

Page 45: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Composed  annotations  for@RequestMapping

•@GetMapping•@PostMapping•@PutMapping•@DeleteMapping•@PatchMapping

Page 46: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

@RestControllerpublic class FooController {

@RequestMapping(path = "foo", method = GET)String getFoo() {/* ... */}

@RequestMapping(path = "foo", method = POST)String postFoo() {/* ... */}

}

Spring  4.2

Composed  annotations  for@RequestMapping

Page 47: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

@RestControllerpublic class FooController {

@GetMapping(path = "foo")String getFoo() {/* ... */}

@PostMapping(path = "foo")String postFoo() {/* ... */}

}

Spring  4.3

Composed  annotations  for@RequestMapping

Page 48: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

@RestControllerpublic class FooController {

@GetMapping("foo")String getFoo() {/* ... */}

@PostMapping("foo")String postFoo() {/* ... */}

}

Spring  4.3

Composed  annotations  for@RequestMapping

Page 49: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Composed  annotations  forweb  @Scope s

•@RequestScope•@SessionScope•@ApplicationScope

Page 50: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

@Scope("request", proxyMode=TARGET_CLASS)public class RequestScopeBean {}

@Scope("session", proxyMode=TARGET_CLASS)public class SessionScopeBean {}

@Scope("application", proxyMode=TARGET_CLASS)public class ApplicationScopeBean {}

~∼Spring  4.2

Composed  annotations  forweb  @Scope s

Page 51: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

@RequestScopepublic class RequestScopeBean {}

@SessionScopepublic class SessionScopeBean {}

@ApplicationScopepublic class ApplicationScopeBean {}

Spring  4.3

Composed  annotations  forweb  @Scope s

Page 52: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

@GetMapping("foo")String foo(@SessionAttribute("foo")String foo) {

// equals to sessiong.getAttribute("foo")}

@GetMapping("bar")String bar(@RequestAttribute("bar")String bar) {

// equals to request.getAttribute("bar")}

Spring  4.3

@SessionAttribute/@RequestAttributefor  access  to  session/request  attributes

Page 53: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Spring  Boot  1.4•Banner  Update•Test  Improvements•Spring  Framework  4.3  Support•Misc

https://github.com/spring-‐‑‒projects/spring-‐‑‒boot/wiki/Spring-‐‑‒Boot-‐‑‒1.4-‐‑‒Release-‐‑‒Notes

Page 54: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Miscellaneous• Spring  Boot  1.4• Startup  error  improvements• Couchbase 2.0  /  Neo4J  Support•@JsonComponent• Spring  Security  4.1• Spring  Data  Hopper  and  so  on...

• Spring  Framework  4.3• Java  Config supports  constructor  injection• Programmatic  resolution  of  dependencies• Cache  abstraction  refinements• Built-‐‑‒in  support  for  HTTP  HEAD  and  OPTIONS• Caffeine  Support• OkHttp3  Support  and  so  on...

Page 55: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Enjoy  Spring  4.3  /  Boot  1.4  !!

Page 56: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Spring  5.0•A  new  framework  generation  for  2017+•5.0  M1  July  2016•5.0  RC1  December  2016

from  Keynote  @  Spring  IO  2016

Page 57: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Spring  5.0•Major baseline upgrade•JDK  8+,  Servlet 3.0+,  JMS  2.0+,  JPA  2.1+,  JUnit 5

•JDK  9,  Jigsaw•HTTP/2•Reactive  Architecture

from  Keynote  @  Spring  IO  2016

Page 58: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Reactor•Yet  Another  Rx  library  on  the  JVM•Natively  built  on  top  of  Reactive  Streams•Developed  by  Pivotal•Non-‐‑‒blocking•Reactor  Core  provides  lite  Rx  API•Flux for  0..N  elements•Mono for  0..1  element

https://projectreactor.io/

Page 59: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach
Page 60: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Spring  Reactive

• Embeds  Reactor• Experimental  project  on  Spring  5  reactive  support• Runs  on• Reactor  Net• RxNetty• Undertow• Servlet  3.1  containers  (Servlet  is  optional  !!)

• Same  programming  model  as  Spring  MVC•Will  be  merged  to  5.x  branch  after  4.3  released

https://github.com/spring-‐‑‒projects/spring-‐‑‒reactive

Page 61: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Spring  Reactive@RestControllerpublic class TodosController {

@GetMapping("todos")Flux<Todo> list() {return this.repository.list();

}

@PostMapping("todos")Mono<Void> create(@RequestBody Flux<Todo> stream) {return this.repository.insert(stream);

}} https://github.com/sdeleuze/spring-‐‑‒reactive-‐‑‒playground

Page 62: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Spring Web Reactive

@MVC

HTTPReactive Streams

Servlet 3.1 Reactor I/O RxNetty

from  Keynote  @  Spring  IO  2016

Page 63: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

from  Keynote  @  Spring  IO  2016Boot Security Data Cloud Integration

Page 64: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Spring  Cloud

Page 65: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Spring  Cloud http://projects.spring.io/spring-‐‑‒cloud/

Page 66: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Spring  Cloud  provides•Service  Discovery•API  Gateway•Client-‐‑‒side  Load  Balancing•Config Server•Circuit  Breakers•Distributed  Tracing

Page 67: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Spring  Cloud  provides•Service  Discovery•API  Gateway•Client-‐‑‒side  Load  Balancing•Circuit  Breakers•Distributed  Configuration•Distributed  Tracing

Eureka

Zuul Ribbon

Hystrix

Zipkin

Page 68: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Microservices with  Spring  Cloud

Page 69: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Go  to  Cloud  Native

Page 70: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Cloud  Native?•"Software  designed  to  run  and  scale  reliably  and  predictably  on  top  of  potentially  unreliable  cloud-‐‑‒based  infrastructure"(Duncan  C.E.  Winn,  Free  O'Reilly  Book:  Intro  to  the  Cloud  Native  Platform)

•Microservices is  a  part  of  Cloud  Native

Page 71: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Cloud  Native

Cloud  Native  

DevOps ContinuousDelivery

ContainersMicroservices

Page 72: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Continuous  DeliveryRelease  once  every  6  

monthsMore  Bugs  in  production

Release  early  and  oftenHigher  Quality  of  Code

DevOpsNot  my  problem

Separate  tools,  varied   incentives,  opaque  process

Shared  responsibilityCommon   incentives,   tools,  process  

and  culture

MicroservicesTightly  coupled  componentsSlow  deployment  cycles  waiting  on  integrated  tests  teams

Loosely  coupled  componentsAutomated  deploy  without  waiting  

on  individual   components

Page 73: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Continuous  DeliveryRelease  once  every  6  

monthsMore  Bugs  in  production

Release  early  and  oftenHigher  Quality  of  Code

DevOpsNot  my  problem

Separate  tools,  varied   incentives,  opaque  process

Shared  responsibilityCommon   incentives,   tools,  process  

and  culture

MicroservicesTightly  coupled  componentsSlow  deployment  cycles  waiting  on  integrated  tests  teams

Loosely  coupled  componentsAutomated  deploy  without  waiting  

on  individual   components

ArchitectureProcessCulture

Page 74: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Why  Microservices?•Speed and  Safety• They  enable  faster  innovation.

Page 75: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Monolith

Page 76: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Service  Oriented  Architecture

Page 77: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Microserviceshttp://www.kennybastani.com/2016/04/event-‐‑‒sourcing-‐‑‒microservices-‐‑‒spring-‐‑‒cloud.html

Page 78: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Monolith  to  Microservices

Page 79: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Monolith  to  Microservices

Page 80: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Chotto-‐‑‒Matte

Page 81: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Start  from  12  Factors  Apphttp://12factor.net/

Page 82: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

I.  CodebaseOne  codebase  tracked  in  SCM,  many  deploys

II.  DependenciesExplicitly  declare  and  isolate  dependencies

III. ConfigurationStore config in theenvironment

VI.  ProcessesExecute  app  as  stateless  processes

V.  Build,  Release,  RunStrictly  separate  build  and  run  stages

IV.  Backing  ServicesTreat  backing  services  as  attached  resources

IX. DisposabilityMaximize robustnesswith fast startup andgraceful shutdown

VIII. ConcurrencyScale  out  via  the  process  model

VII.  Port  bindingExport  services  via  port  binding

XII. Admin processesRun  admin  /  mgmttasks  as  one-‐‑‒off  processes

X. Dev/prod parityKeep  dev,  staging,  prod  as  similar  as  possible

XI. LogsTreat logs as eventstreams

12  Factors  App

Page 83: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Cloud  Native  Platform

Page 84: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Pivotal  Cloud  Foundry

http://pivotal.io/platform

Page 85: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

12  FactorsApp

Auto  Scaling

MultiTenancy

Container

4  Level  HA

AutoHealing

Spring  Cloud  Services

Metrics

OAuth2  SSODocker

IaaSAgnostic

BackendServices

LoggingBlue/GreenDeployment

EasyInstallation

Page 86: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach
Page 87: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Spring  Cloud  Serviceshttp://docs.pivotal.io/spring-‐‑‒cloud-‐‑‒services/

• Netflix  OSS-‐‑‒as-‐‑‒a-‐‑‒service  in  Pivotal  Cloud  Foundry

Page 88: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Microservices with  Spring  Cloud

Page 89: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Microservices with  SCS

Page 90: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Remove  boilerplate  code,  implement  patterns

Application  coordination  boilerplate  patterns

Application  configuration  boilerplate  patterns

Enterprise  application  boilerplate  patterns  

Runtime  Platform,  Infrastructure  Automation  boilerplate  patterns  (provision,  deploy,  secure,  log,  data  services,  etc.)

CLOUD

DESKTOP

Spring  Boot

Spring  IO  Platform

Pivotal  Cloud  Foundry

Spring  Cloud

Microservice operation  boilerplate  patterns  (ConfigServer,  Service  Discovery,  Circuit  Breaker)

SERVICES

Spring  Cloud  Services

Page 91: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach
Page 92: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Concourse  CIhttps://concourse.ci

Page 93: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Concourse  CI  Overview

http://www.slideshare.net/gwennetourneau/concourseci-‐‑‒overview

Page 94: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

How  Pivotal  make  cycle  of  code  seamless!!

Page 95: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

DEMOdeploy https://github.com/metflix

Page 96: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach
Page 97: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

More  practical  pipeline

https://github.com/making/concourse-‐‑‒ci-‐‑‒demo

Page 98: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

More  practical  pipeline

https://github.com/making/concourse-‐‑‒ci-‐‑‒demo

Page 99: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Pivotal  Cloud  Foundry  for  Local  Developmenthttps://docs.pivotal.io/pcf-‐‑‒dev/

Page 100: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Tutorials• http://pivotal.io/platform/pcf-‐‑‒tutorials/getting-‐‑‒started-‐‑‒with-‐‑‒pivotal-‐‑‒cloud-‐‑‒foundry• https://github.com/Pivotal-‐‑‒Japan/cf-‐‑‒workshop• https://github.com/Pivotal-‐‑‒Japan/cloud-‐‑‒native-‐‑‒workshop

Page 101: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

EBooks  (Free!)

• http://pivotal.io/platform/migrating-‐‑‒to-‐‑‒cloud-‐‑‒native-‐‑‒application-‐‑‒architectures-‐‑‒ebook• http://pivotal.io/cloud-‐‑‒foundry-‐‑‒the-‐‑‒cloud-‐‑‒native-‐‑‒platform• http://pivotal.io/beyond-‐‑‒the-‐‑‒twelve-‐‑‒factor-‐‑‒app

Page 102: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach

Summary• Spring  4.3,  Spring  Boot  1.4  Jun  2016• DI・MVC  Improvements,  Composed  Annotations  ...• Image  Banner,  Test  Improvements,  ...  

• Spring  5.0  • JDK  8+,  JDK9,  HTTP/2,  Reactive

• Cloud  Native• Microservices

• Speed  &  Safety• Independently  Deployable  

• Continuous  Delivery• Concourse  CI

• Containers,  DevOps• Cloud  Foundry  as  a  Cloud  Native  Platform

Page 103: #jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's Cloud Native Approach