Slide 1

Slide 1 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ SPRINGONE2GX WASHINGTON, DC Isomorphic templating with
 Spring Boot, Nashorn and React Sébastien Deleuze @sdeleuze

Slide 2

Slide 2 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Agenda • Isomorphic? • Script based templating support in Spring • Handlebars support • What is React? • Isomorphic application with Spring and React • Demo • What’s next? 2

Slide 3

Slide 3 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Isomorphic? 3

Slide 4

Slide 4 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Isomorphic 4 Shared code that runs on both the client & server

Slide 5

Slide 5 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Use cases • Templating - User interface • I18n • Application logic • Routing • Model validation 5

Slide 6

Slide 6 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Why? 1. Performance • Initial pageload speed • Huge impact on mobile 2. Maintainability • Share more code between client and server • A single technology to learn 3. SEO - Accessibility • Make your site more crawlable and accessible 6

Slide 7

Slide 7 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Principle 7 Server Client Ȑ Content + UI Content + UI +
 DOM event listeners

Slide 8

Slide 8 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Your website is … 8 Application
 centric Content
 centric

Slide 9

Slide 9 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ GitHub as an example 9

Slide 10

Slide 10 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Script based templating
 support in Spring 10

Slide 11

Slide 11 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Support JSR 223 script engines 11 https://jira.spring.io/browse/SPR-12266: Support JavaScript Templating

Slide 12

Slide 12 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Nashorn • Bundled with JRE 8+ • Evolve fast • Min. requirement: Java 8u66 12

Slide 13

Slide 13 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Nashorn code sample 13 ScriptEngineManager manager = new ScriptEngineManager();
 ScriptEngine engine = manager.getEngineByName("nashorn");
 Invocable invocable = (Invocable)engine;
 
 String result = (String)invocable.invokeFunction("hello", "Brian"); function hello(name) {
 return "Hello " + name;
 }

Slide 14

Slide 14 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Available in Spring Framework 4.2 14 And in the upcoming Spring Boot 1.3 GA

Slide 15

Slide 15 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Javascript based template engines 15 Mustache

Slide 16

Slide 16 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Handlebars templates 16 
 
 {{title}}
 
 

    
 {{#each comments}}

  • {{author}} {{content}}
  • 
 {{/each}}


 


Slide 17

Slide 17 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring MVC controller 17 @Controller
 public class HandlebarsController {
 
 @RequestMapping(path = "/home", method = RequestMethod.GET)
 String home(Model model) {
 model.addAttribute("title", "Title example");
 List comments = Arrays.asList(
 new Comment("author1", "content1"),
 new Comment("author2", "content2"),
 new Comment("author3", "content3"));
 model.addAttribute("comments", comments);
 return "home";
 }
 }

Slide 18

Slide 18 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring MVC controller revisited 18 @Controller
 public class HandlebarsController {
 
 @RequestMapping(path = "/home", method = RequestMethod.GET)
 Map home() {
 return hash(title -> "Title example",
 comments -> asList(
 new Comment("author1", "content1"),
 new Comment("author2", "content2"),
 new Comment("author3", "content3"))
 );
 }
 } View name guessed from the URL
 thanks to RequestToViewNameTranslator Hash literal using java 8u60 with -parameters and lambda type references

Slide 19

Slide 19 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring MVC controller re-revisited 19 @Controller
 public class HandlebarsController {
 
 @Get("/home")
 Map home() {
 return hash(title -> "Title example",
 comments -> asList(
 new Comment("author1", "content1"),
 new Comment("author2", "content2"),
 new Comment("author3", "content3"))
 );
 }
 } spring-composed annotation based on @AliasFor https://github.com/sbrannen/spring-composed

Slide 20

Slide 20 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Dependency Management 20 
 org.webjars
 handlebars
 3.0.0-1


Slide 21

Slide 21 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Script based templating configuration 21 @Bean
 ViewResolver viewResolver() {
 ScriptTemplateViewResolver viewResolver = new ScriptTemplateViewResolver();
 viewResolver.setPrefix("/static/templates/");
 viewResolver.setSuffix(".html");
 return viewResolver;
 } View resolver

Slide 22

Slide 22 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Script based templating configuration 22 @Bean
 ScriptTemplateConfigurer configurer() {
 ScriptTemplateConfigurer configurer = new ScriptTemplateConfigurer();
 configurer.setEngineName("nashorn");
 configurer.setScripts("/static/polyfill.js",
 "/META-INF/resources/webjars/handlebars/3.0.0-1/handlebars.js",
 "/static/render.js");
 configurer.setRenderFunction("render");
 configurer.setSharedEngine(false);
 return configurer;
 } Configurer

Slide 23

Slide 23 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Concurrency with Nashorn 23 • In web browsers, no simultaneous execution of your code • Nashorn itself is NOT thread-safe by design • The behavior depends of your Javascript code • Worth to read Nashorn Multithreading and MT-safety

Slide 24

Slide 24 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ The sharedEngine property 24 • When sharedEngine is set to false, Spring uses ThreadLocal • Handlebars and React need sharedEngine=false • Mustache works perfectly with a single ScriptEngine (defaults) • Be careful on memory consumption

Slide 25

Slide 25 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ polyfill.js 25 var window = {};

Slide 26

Slide 26 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ render.js 26 /** String template: the template content Map model: the view model String url: the template url (since 4.2.2) **/ function render(template, model, url) {
 // ...
 }
 
 // Since url is optional, you can also declare: function render(template, model) {
 // ...
 }

Slide 27

Slide 27 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Handlebars render() implementation 27 var templates = {};
 
 function render(template, model, url) {
 var compiledTemplate;
 if (templates[url] === undefined) {
 compiledTemplate = Handlebars.compile(template);
 templates[url] = compiledTemplate;
 }
 else {
 compiledTemplate = templates[url];
 }
 return compiledTemplate(toJsonObject(model));
 }
 
 // Create a real JSON object from the model Map
 function toJsonObject(model) { … }

Slide 28

Slide 28 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Model to JSON Object conversion 28 // Create a real JSON object from the model Map
 function toJsonObject(model) {
 var o = {};
 for (var k in model) {
 // Convert Iterable like List to real JSON array
 if (model[k] instanceof Java.type("java.lang.Iterable")) {
 o[k] = Java.from(model[k]);
 }
 else {
 o[k] = model[k];
 
 }
 }
 return o;
 }

Slide 29

Slide 29 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Is it fast? 29

Slide 30

Slide 30 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Yes :-) 30 6000 page/s on my laptop

Slide 31

Slide 31 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring MVC + Handlebars production ready ? 31 • Nice to use • handlebars-layouts • Easy to customize • Quite fast • Young stack • Latest Java 8 needed • Load partials from classpath nashorn.eval(new InputStreamReader(getClass().getResourceAsStream("file.js")));

Slide 32

Slide 32 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Experiment, contribute! 32 https://github.com/sdeleuze/spring-boot-sample-web-handlebars

Slide 33

Slide 33 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ What is React? 33

Slide 34

Slide 34 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 34 • A Javascript library for building user interfaces • Component oriented • Not a full-stack framework • Virtual DOM diffing/updating • Server side rendering

Slide 35

Slide 35 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ DOM diffing 35 http://techblog.constantcontact.com/software-development/reactive-component-based-uis/

Slide 36

Slide 36 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ It’s Like Source Control for the DOM 36

Slide 37

Slide 37 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Before showing you JSX code … 37

Slide 38

Slide 38 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ React component: comment.js 38 var Comment = React.createClass({
 handleClick: function(event) {
 alert(this.props.content);
 },
 render: function () {
 return (


{ this.props.author }

{ this.props.content }

View details »


 )
 }
 });

Slide 39

Slide 39 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ JSX transformer 39

{ this.props.author }

{ this.props.content }

View details »

React.createElement("div", {className: "col-md-4"}, 
 React.createElement("h2", null, this.props.author), 
 React.createElement("p", null, this.props.content, " "), 
 React.createElement("p", null, React.createElement("a", {className: "btn btn-default", href: "#", role: "button", onClick: this.handleClick}, "View details") )
 )

Slide 40

Slide 40 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ The most interesting man in the world about JSX … 40

Slide 41

Slide 41 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ React component: comment-list.js 41 var CommentList = React.createClass({
 getInitialState: function () {
 return this.props;
 },
 render: function () {
 var commentNodes = this.state.comments.map(function (comment) {
 return 
 });
 return (


 { commentNodes }


 )}});
 
 React.render(,
 document.getElementById("comments"));

Slide 42

Slide 42 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Isomorphic application
 with Spring and React 42

Slide 43

Slide 43 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Gradle configuration 43 apply plugin: 'java'
 apply plugin: 'spring-boot'
 plugins {
 id 'net.eikehirsch.react' version '0.3.1'
 }
 
 sourceCompatibility = 1.8
 targetCompatibility = 1.8
 
 dependencies {
 compile('org.springframework.boot:spring-boot-starter-web')
 compile('org.webjars:react:0.13.1')
 testCompile('org.springframework.boot:spring-boot-starter-test')
 }
 
 jsx {
 sourcesDir = 'src/main/resources/static/jsx'
 destDir = 'src/main/resources/static/output'
 } processResources.dependsOn('jsx')

Slide 44

Slide 44 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Page composition 44

Slide 45

Slide 45 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Controller 45 @Controller
 public class CommentController {
 
 private CommentRepository commentRepository;
 
 @Autowired
 CommentController(CommentRepository commentRepository) {
 this.commentRepository = commentRepository;
 }
 
 @RequestMapping("/")
 String render(Model model) {
 model.addAttribute("title", "Layout example");
 model.addAttribute("comments", this.commentRepository.findAll());
 return "index";
 }
 }

Slide 46

Slide 46 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ index.ejs 46 
 
 
 
 


 


 <%= React.renderToString(React.createElement(CommentList, { comments: comments} )) %>


 
 
 
 
 <
 


Slide 47

Slide 47 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Server side rendering 47

Slide 48

Slide 48 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ client.js (client side rendering) 48 React.render( , document.getElementById("navbar"));
 
 $.getJSON('/', function( data ) {
 React.render(, document.getElementById("comments"));
 });

Slide 49

Slide 49 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Server and client side = same output 49 React re-render everything BUT: - No flickering thanks to Virtual DOM diff - React just attach the DOM listeners

Slide 50

Slide 50 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ polyfill.js 50 var global = this;
 var console = {};
 console.debug = print;
 console.warn = print;
 console.log = print;

Slide 51

Slide 51 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ render.js 51 function render(template, model) {
 var data = toJsonObject(model);
 return new EJS({text: template}).render(data);
 }

Slide 52

Slide 52 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Issue: script duplication 52 
 
 
 
 
 
 configurer.setScripts("static/polyfill.js",
 "static/lib/js/ejs.min.js",
 "/META-INF/resources/webjars/react/0.13.1/react.js",
 "static/render.js",
 "static/output/comment.js",
 "static/output/comment-form.js",
 "static/output/comment-list.js");

Slide 53

Slide 53 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 53 Develop a Javascript module loader server extension
 that loads resources from the classpath nashorn.eval(new InputStreamReader(getClass().getResourceAsStream("file.js")));

Slide 54

Slide 54 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ SSE (server) 54 @Controller
 public class CommentController {
 private final List sseEmitters = new ArrayList<>();
 
 @RequestMapping(path = "/", method = RequestMethod.POST, produces = "application/json")
 @ResponseBody
 Comment jsonCreate(Comment comment) throws IOException {
 Comment newComment = this.commentRepository.save(comment);
 for (SseEmitter sseEmitter : this.sseEmitters) {
 sseEmitter.send(newComment, MediaType.APPLICATION_JSON);
 }
 return comment;
 }
 
 @RequestMapping("/sse/updates")
 SseEmitter subscribeUpdates() {
 SseEmitter sseEmitter = new SseEmitter();
 this.sseEmitters.add(sseEmitter);
 sseEmitter.onCompletion(() -> {
 this.sseEmitters.remove(sseEmitter);
 });
 return sseEmitter;
 }
 }

Slide 55

Slide 55 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ SSE (client) 55 var CommentList = React.createClass({
 componentDidMount: function() {
 var eventSource = new EventSource("/sse/updates");
 var self = this;
 eventSource.onmessage = function(e) {
 var comment = JSON.parse(e.data);
 var comments = self.state.comments;
 var newComments = comments.concat([comment]);
 self.setState({comments: newComments});
 };
 },
 // ...
 });

Slide 56

Slide 56 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Demo 56

Slide 57

Slide 57 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ What’s next? 57

Slide 58

Slide 58 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 58 EcmaScript 6

Slide 59

Slide 59 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 59 TypeScript TypeScript = EcmaScript 6
 + types + decorators (annotations) + …

Slide 60

Slide 60 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 60 Ember 2

Slide 61

Slide 61 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 61 Angular 2

Slide 62

Slide 62 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 62 Angular 2 @Component({selector: 'my-app'})
 @View({template: '

Hi {{ name }}

'})
 // Component controller
 class MyAppComponent {
 constructor() {
 this.name = 'Ali';
 }
 }

Slide 63

Slide 63 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 63 Routing Need to build a bridge between server side and client side routing …

Slide 64

Slide 64 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 64 Spring 5 draft roadmap for serverside JS • Builtin Java to JSON object conversion • JS logging on server side • Facilities to load content from filesystem/classpath • Script loader extension (classpath instead of Ajax request) • Ember2/Angular2/React support? • Spring beans accessible from Javascript?

Slide 65

Slide 65 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 65 Experiments and contributions welcomed!

Slide 66

Slide 66 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 66 Conclusion • Javascript evolves: ES6 - TypeScript • Javascript frameworks are becoming more mature: React - EmberJS 2 - Angular 2 • Isomorphic applications provide a nice balance between server side rendering and Javascript based RIA • Develop your front-end skills and try by yourself! • The choice of the client side technology/software design is key differentiator for your project/product!

Slide 67

Slide 67 text

Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Thanks! 67 https://github.com/sdeleuze/spring-boot-sample-web-handlebars https://github.com/sdeleuze/spring-react-isomorphic @sdeleuze