Develop Hip APIs and Apps with Spring Boot and Angular - Java2Days 2017

Develop Hip APIs and Apps with Spring Boot and Angular - Java2Days 2017

In this session, you’ll learn how to develop APIs with Java 8 and Spring Boot, then deploy them to the cloud. You’ll also learn how to develop apps with the latest version of Angular, make them work offline, and optimize them for production. I’ll show how to do this all with JHipster.

JHipster generates an application with Java 8, SQL or NoSQL databases, Spring profiles, Maven or Gradle, Webpack, WebSockets and BrowserSync. It also supports a number of different authentication mechanisms: classic session-based auth, OAuth 2.0, or JWT-based authentication. For production deployments, JHipster includes out-of-the-box support for AWS, Cloud Foundry, Heroku, as well as Docker and Kubernetes.

Source code from demo: https://github.com/mraible/java2days2017-jhipster-demo

72a2082c6a4dd79ad68befb3db911616?s=128

Matt Raible

October 18, 2017
Tweet

Transcript

  1. Matt Raible | @mraible Develop Hip APIs and Apps October

    18, 2017
  2. Blogger on raibledesigns.com Old Fashioned Java Developer turned Java Hipster

    Father, Skier, Mountain Biker, Whitewater Rafter Open Source Connoisseur Who is Matt Raible? Bus Lover Okta Developer Advocate
  3. None
  4. None
  5. None
  6. public class Okta { public Okta(DeveloperDNA developerDna) { DeveloperRelations devRel

    = developerDna.getDeveloperRelations(); Assert.notNull(devRel,"Developer Relations is required to operate effectively."); Set<Developer> team = devRel.getTeam(); Assert.isTrue(!team.isEmpty(),"Team cannot be empty."); Assert.isTrue(!devRel.getSdks().isEmpty(), "SDKs required for developers."); } }
  7. Authentication Standards

  8. What about YOU? Are you a Java Developer? Web Developer?

    How long have you been doing web development? Do you like JSF? Do you like GWT? Do you like JavaScript?
  9. Do you want to be a hip Java Developer?

  10. Java 8 Parallel Collections JSR 310 Date and Time API

    Functional Interfaces with default method Lambda Expressions (a.k.a. Closures) Nashorn JavaScript Engine
  11. Hipster n. noun 1. One who is exceptionally aware of

    or interested in the latest trends and tastes.
  12. None
  13. Latest trends in JavaLand? Microservices Embedded App Servers Deployment with

    Containers Environments: dev, test, production Auto-Configuration Monitoring
  14. 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
  15. SPRING INITIALIZR @ start.spring.io

  16. @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<Blog, Long> { }
  17. @SpringBootApplication class NotesApplication fun main(args: Array<String>) { SpringApplication.run(NotesApplication::class.java, *args) }

    @Entity data class Note(@Id @GeneratedValue var id: Long? = null, var text: String? = null, @JsonIgnore var user: String? = null) @RepositoryRestResource interface NotesRepository : JpaRepository<Note, Long>
  18. None
  19. @spring_io #springio17 Microservices with Spring Boot https://developer.okta.com/blog/2017/06/15/build-microservices-architecture-spring-boot

  20. Latest trends in Web Development? Progressive Web Applications JavaScript MVC

    Frameworks CSS 3 with Animations Mobile First Front-End Optimization REST APIs
  21. None
  22. None
  23. @spring_io #springio17 Jobs on Indeed September 2017 0 1,750 3,500

    5,250 7,000 Angular Aurelia Backbone Ember Knockout React Vue
  24. @spring_io #springio17 Stack Overflow Tags September 2017 0 20,000 40,000

    60,000 80,000 Angular Aurelia Backbone Knockout Ember React Vue
  25. @spring_io #springio17 GitHub Stars September 2017 0 20,000 40,000 60,000

    80,000 Angular Aurelia Backbone Knockout Ember React Vue
  26. @spring_io #springio17 GitHub Star Growth

  27. Wouldn’t it be hip if…? ⚭

  28. JHipster www.jhipster.tech

  29. JHipster is Open Source Web Statistics, September 2017 312K Page

    Views / 455K on GitHub 42K Downloads GitHub Statistics 8165 Stars 366 Contributors
  30. JHipster Spring Boot Spring Security AngularJS Angular Bootstrap Metrics Maven

    or Gradle Authentication Type: cookie-based (with Social), JWT, or OAuth 2.0 Type of Database: SQL or NoSQL Caching: EhCache or Hazelcast Elasticsearch Gulp.js or Webpack Foundational Frameworks Project Options
  31. How to use JHipster To install JHipster and Yeoman, use

    npm: npm install -g yo generator-jhipster Then create a directory and cd into it: mkdir myapp && cd myapp Then run Yeoman: yo jhipster
  32. Generate a basic blog application Look at its files and

    configuration 
 Generate the CRUD entities Limit blogs to current user, allow HTML Deploy to Demo Time! … all in 20 minutes! ☁
  33. Demo Entity Diagram

  34. Validate ID Token Token Endpoint Authorization Endpoint /.well-known/
 openid-configuration JWKS

    Endpoint UserInfo Endpoint OAuth 2.0 Authorization Server & OpenID Connect Provider (OP) OAuth 2.0 Resource Server Client (Relying Party) 1 3 2 5 4 1 Discover OpenID Provider Metadata 2 Perform OAuth flow to obtain a ID token and/or access token 3 Get JSON Web Key Set (JWKS) for signature keys 4 Validate ID token
 (JSON Web Token) 5 Get additional user attributes with access token from UserInfo endpoint OpenID Connect
  35. developer.okta.com

  36. Get Started with JHipster 4 Demo https://github.com/mraible/jhipster4-demo https://www.youtube.com/watch?v=XRREt1KB4Y8

  37. None
  38. JHipster is Knowledge

  39. The JHipster Mini-Book Written with Asciidoctor Quick and to the

    point, 130 pages Developed a Real World App: www.21-points.com Free Download from infoq.com/minibooks/jhipster-4-mini-book
  40. Lines of Code in 21-Points 0 5750 11500 17250 23000

    Project Created Entities Generated Business Logic and UI 22,876 21,355 15,173
  41. Learn More twitter.com/java_hipster www.jhipster.tech github.com/jhipster/generator-jhipster Get Started with JHipster 4:

    https://youtu.be/XRREt1KB4Y8 JHipster Microservices, Google Cloud, and Kubernetes
 https://youtu.be/dgVQOYEwleA
  42. Getting Help stackoverflow.com/tags/jhipster gitter.im/jhipster/generator-jhipster github.com/jhipster/.../CONTRIBUTING.md groups.google.com/.../jhipster-dev

  43. What’s New and Next? http://start.jhipster.tech now available! JHipster Registry v3

    Spring Boot 2.0 / Spring Webflux React Support OAuth 2.0 / OIDC Support https://www.slideshare.net/julien.dubois/jhipster-overview-and-roadmap-august-2017
  44. developer.okta.com/blog

  45. Action! Try Spring Boot Try Angular Try JHipster Explore PWAs

    Enjoy the bootiful experience!
  46. Questions? Keep in touch! raibledesigns.com @mraible Presentations speakerdeck.com/mraible Code github.com/oktadeveloper