Slide 1

Slide 1 text

Matt Raible | @mraible Bootiful Development with Spring Boot and React April 23, 2019 Photo by Premnath Thirumalaisam https://www.flickr.com/photos/premnath/9939139384

Slide 2

Slide 2 text

Blogger on raibledesigns.com and developer.okta.com/blog Web Developer and Java Champion Father, Skier, Mountain Biker, Whitewater Rafter Open Source Connoisseur Who is Matt Raible? Bus Lover Okta Developer Advocate

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

developer.okta.com

Slide 7

Slide 7 text

What About You?

Slide 8

Slide 8 text

Bootiful Development http://bit.ly/boot-and-react

Slide 9

Slide 9 text

OAuth 2.0 Overview Today’s Agenda Why Spring Boot? Demo: Developing with Spring Boot Introduction to ES6 and TypeScript Why React? Demo: Developing with React Introduction to PWAs and JHipster

Slide 10

Slide 10 text

Spring Boot Automatically configures Spring whenever possible Provides production-ready features such as metrics, health checks and externalized configuration Absolutely no code generation and no requirement for XML configuration Embeds Tomcat, Jetty or Undertow directly

Slide 11

Slide 11 text

SPRING INITIALIZR @ start.spring.io

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

@SpringBootApplication public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } } @Entity class Blog { @Id @GeneratedValue private Long id; private String name; // getters, setters, toString(), etc } @RepositoryRestResource interface BlogRepository extends JpaRepository { }

Slide 14

Slide 14 text

@spring_io #springio17 Microservices with Spring Boot https://developer.okta.com/blog/2017/06/15/build-microservices-architecture-spring-boot

Slide 15

Slide 15 text

@spring_io #springio17 Secure Microservices with Spring Boot https://developer.okta.com/blog/2018/02/13/secure-spring-microservices-with-oauth

Slide 16

Slide 16 text

Demo: Build a Spring Boot API

Slide 17

Slide 17 text

ES6, ES7 and TypeScript ES5: es5.github.io ES6: git.io/es6features ES7: bit.ly/es7features TS: www.typescriptlang.org TS ES7 ES6 ES5

Slide 18

Slide 18 text

TypeScript $ npm install -g typescript function greeter(person: string) {
 return "Hello, " + person;
 }
 
 var user = "Jane User";
 
 document.body.innerHTML = greeter(user); $ tsc greeter.ts https://www.typescriptlang.org/docs/tutorial.html

Slide 19

Slide 19 text

@spring_io #springio17 bus.ts

Slide 20

Slide 20 text

“Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non- blocking I/O model that makes it lightweight and efficient. Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries in the world.” https://nodejs.org https://github.com/creationix/nvm

Slide 21

Slide 21 text

@spring_io #springio17 Leading JavaScript Frameworks in 2019 angular.io facebook.github.io/react vuejs.org

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

“2018: The Year of React React won the popularity battle in 2017.”

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

“React kept a firm grip on its lead in 2018.”

Slide 26

Slide 26 text

Crunch the Numbers

Slide 27

Slide 27 text

Hot Frameworks hotframeworks.com

Slide 28

Slide 28 text

Hot Frameworks hotframeworks.com

Slide 29

Slide 29 text

Jobs on Indeed (US) April 2019 0 2,500 5,000 7,500 10,000 React Angular Vue Vanilla

Slide 30

Slide 30 text

Stack Overflow Tags April 2019 0 45,000 90,000 135,000 180,000 React Angular Vue

Slide 31

Slide 31 text

GitHub Stars April 2019 0 35,000 70,000 105,000 140,000 React Angular Vue

Slide 32

Slide 32 text

Hello World with React http://codepen.io/gaearon/pen/ZpvBNJ?editors=0100
ReactDOM.render( <h1>Hello, world!</h1>, document.getElementById('root') );

Slide 33

Slide 33 text

Imperative Code if (count > 99) { if (!hasFire()) { addFire(); } } else { if (hasFire()) { removeFire(); } } if (count === 0) { if (hasBadge()) { removeBadge(); } return; } if (!hasBadge()) { addBadge(); } var countText = count > 99 ? "99+" : count.toString(); getBadge().setText(countText);

Slide 34

Slide 34 text

Declarative Code if (count === 0) { return
; } else if (count <= 99) { return (
{count}
); } else { return (
99+
); }

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

Learning React https://vimeo.com/213710634

Slide 37

Slide 37 text

@spring_io #springio17 React Courses on egghead.io https://blog.kentcdodds.com/learn-react-fundamentals-and-advanced-patterns-eac90341c9db

Slide 38

Slide 38 text

@spring_io #springio17 Progressive Web Apps

Slide 39

Slide 39 text

“We’ve failed on mobile” — Alex Russell https://youtu.be/K1SFnrf4jZo

Slide 40

Slide 40 text

Mobile Hates You! How to fight back: Implement PRPL Get a ~$150-200 unlocked Android (e.g. Moto G4) Use chrome://inspect && chrome://inspect?tracing Lighthouse DevTools Network & CPU Throttling

Slide 41

Slide 41 text

The PRPL Pattern Push critical resources for the initial URL route Render initial route Pre-cache remaining routes Lazy-load and create remaining routes on demand

Slide 42

Slide 42 text

Learn More about PWAs https://developer.okta.com/blog/2017/07/20/the-ultimate-guide-to-progressive-web-applications

Slide 43

Slide 43 text

Demo: Build a React Client class BeerList extends React.Component<{}, any> { constructor(props: any) { super(props); this.state = { beers: [], isLoading: false }; } componentDidMount() { this.setState({isLoading: true}); fetch('http://localhost:8080/good-beers') .then(response => response.json()) .then(data => this.setState({beers: data, isLoading: false})); } render() { const {beers, isLoading} = this.state; … } }

Slide 44

Slide 44 text

@spring_io #springio17 JHipster jhipster.tech JHipster is a development platform to generate, develop and deploy Spring Boot + Angular/React Web applications and Spring microservices. and Vue! ✨

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

The JHipster Mini-Book 5.0.2 Released last week! jhipster-book.com 21-points.com @jhipster_book Write your own InfoQ mini-book! github.com/mraible/infoq-mini-book

Slide 47

Slide 47 text

Action! Try Spring Boot Try React Try Okta Explore PWAs Enjoy the bootiful experience!

Slide 48

Slide 48 text

DIY: Bootiful Development http://bit.ly/boot-and-react

Slide 49

Slide 49 text

CRUD with React and Spring Boot http://bit.ly/react-boot-crud

Slide 50

Slide 50 text

Bootiful React with a Java EE API https://developer.okta.com/blog/2018/09/12/secure-java-ee-rest-api

Slide 51

Slide 51 text

developer.okta.com/blog @oktadev

Slide 52

Slide 52 text

Questions? Keep in touch! raibledesigns.com @mraible Presentations speakerdeck.com/mraible Code github.com/oktadeveloper