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/ Spring Boot 1.3 pour le web Stéphane Nicoll @snicoll Brian Clozel @brianclozel

Slide 2

Slide 2 text

Comment créer une appli web avec Spring Boot 1.3?

Slide 3

Slide 3 text

Externalized Configuration § Gérer la configuration d’une application § application-*.properties, application.yml § Clés définies par l’équipe Spring Boot
 « server.port », « spring.datasource… »

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

L’équipe Spring Boot doit gérer
 ces clés de propriétés!

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

Création d’une appli web pour gérer ces clés de props § Charger les artifacts maven § Lire les méta-données depuis les artifacts maven § Générer un modèle représentant les différences § Orchestrer le tout dans une application web!

Slide 8

Slide 8 text

Toutes les étapes sont déjà ici: § https://github.com/snicoll-demos/spring-boot-4tw-uni/
 § https://speakerdeck.com/snicoll

Slide 9

Slide 9 text

Live coding!

Slide 10

Slide 10 text

Custom banner.txt !

Slide 11

Slide 11 text

Avec Spring Boot 1.4
 
 #TweetABootBanner on Twitter

Slide 12

Slide 12 text

Validation: JSR-303 support org.springframework.boot spring-boot-starter-validation @Constraint(validatedBy = VersionValidator.class)

Slide 13

Slide 13 text

§ http://docs.spring.io/spring-boot/docs/current/reference/html/using- boot-devtools.html Spring Boot Developer Tools org.springframework.boot spring-boot-devtools true

Slide 14

Slide 14 text

Spring MVC Resource chain + Boot integration § Gérer les ressources statiques de l’application § Plus d’exemples: • https://github.com/bclozel/spring-resource-handling • https://github.com/bclozel/resource-handling-workshop

Slide 15

Slide 15 text

Actuator: custom Health check @Bean public HealthIndicator forTheWebHealthIndicator() { return () -> { if (new Random().nextBoolean()) { return Health.up().build(); } else { return Health.down() .withDetail("Ooops", 42).build(); } }; }

Slide 16

Slide 16 text

Actuator: CounterService @Autowired private CounterService counterService; private void logMetrics(DiffRequest diffRequest) { this.counterService.increment("diff.from." + diffRequest.getFromVersion()); this.counterService.increment("diff.to." + diffRequest.getToVersion()); }

Slide 17

Slide 17 text

Caching auto-configuration in Spring Boot @Bean public JCacheManagerCustomizer cacheManagerCustomizer() { return cm -> { cm.createCache("diffs", new MutableConfiguration<>() .setExpiryPolicyFactory(CreatedExpiryPolicy .factoryOf(Duration.ONE_HOUR)) .setStoreByValue(false) .setStatisticsEnabled(true)); }; }

Slide 18

Slide 18 text

Create your own type safe config classes § Describe app properties in POJOs + javadoc § Declare them as @ConfigurationProperties § Scan them with @EnableConfigurationProperties § Metadata is generated by spring-boot-configuration-processor § Get IDE support and type-safe configuration in your app!

Slide 19

Slide 19 text

Spring Framework 4.2 integration § Jackson @JsonView § HTTP Caching improvements § CORS support with @CrossOrigin

Slide 20

Slide 20 text

Questions?

Slide 21

Slide 21 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/ The Spring BOF Jeudi 19h45-20h35

Slide 22

Slide 22 text

Merci! 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/ Stéphane Nicoll
 [email protected] 
 Brian Clozel [email protected]