SlideShare a Scribd company logo
1 of 38
Download to read offline
Using JHipster 4 for generating
Angular/Spring Boot apps
Yakov Fain
Farata Systems

yfain
About myself
• Work for Farata Systems
• Java Champion
• Latest book:

“Angular Development with TypeScript”
Agenda
• Part 1 

- Start a Spring Boot app that serves products

- Generate a Web client with Angular CLI

- Deploy the Angular app under Spring Boot
• Part 2 

- Generate an Angular/Spring Boot app with JHipster

- Monolithic vs Microservices

- Generating entities 

- Internationalization
Good frameworks make
you write less code
What’s Spring Boot?
An opinionated runtime for Spring projects
https://start.spring.io
Our Spring Boot Controller
@RestController

@RequestMapping("/api")

public class ProductController {



Product products[] = new Product[3];



ProductController(){

products[0] = new Product(0,"First product", 59.99);

products[1] = new Product(1,"Second product", 12.50);

products[2] = new Product(2,"Third product", 14.40);

}



@RequestMapping(value="products",

method = RequestMethod.GET,

produces= MediaType.APPLICATION_JSON_VALUE)

public Product[] getProducts(){

return products;

}

}
Demo
• Start a Spring Boot App from the server dir
What’s Angular?
An opinionated platform for developing front-
end of Web apps
What’s Angular CLI?
An opinionated tool that generates and
bundles Angular projects
@Component({
selector: 'app-root',
template: `<h1>All Products</h1>
<ul>
<li *ngFor="let product of products">
{{product.title}}
</li>
</ul>
`})
export class AppComponent {
products: Array<string> = [];
theDataSource: Observable<string>;
constructor(private http: Http) {
this.theDataSource = this.http.get('/api/products')
.map(res => res.json());
}
ngOnInit(){
this.theDataSource.subscribe( // Get the data from the Spring Boot server
data => this.products=data,
err => console.log(“Got and error. Code: %s, URL: %s ", err.status, err.url));
}
}
Our Angular Client
Server’s

endpoint
Demo
Generating a new Angular project called client to
display products
scripts": {

"build": "ng build -prod",

"postbuild": "npm run deploy",

"predeploy": "rimraf ../server/src/main/resources/static && 

mkdirp ../server/src/main/resources/static",

"deploy": "copyfiles -f dist/** ../server/src/main/resources/
static"
}
Automating deployment with
npm scripts
static

resources
Spring

Boot app
Bundled 

Angular app
Adding packages for deployment to
package.json
"copyfiles": "^1.0.0",
"mkdirp": "^0.5.1",
"rimraf": "^2.5.4"
Demo

Our Angular app deployed in Spring Boot
Java
Angular
When I was young...
I just needed to learn a couple of tools
Do you know all these?
• Yeoman
• npm
• Yarn
• Maven
• Gradle
• Docker
• My SQL
• H2
• Liquibase
• JDL Studio
• Webpack
• SwaggerUI
• Consul
• Angular
• Java
• JavaScript
• TypeScript
• Spring
• JWT
• RESTFul Web
services
• JSON
• HTML
What’s Yeoman?
An opinionated tool for kickstarting new
Web projects and generating things
What’s JHipster?
• An opinionated Yeoman generator to generate, 

develop, and deploy Spring Boot + Angular projects
• Docs: https://jhipster.github.io
• 500K downloads, 7300 stars on GitHub, 340 contributors
Why use JHipster?
• Generates a working Angular/Spring Boot in
minutes
• Automates the manual work
• Shows best practices
• Simplifies cloud deployment
Getting started
• Install node.js from https://nodejs.org
• Install the Yarn package manager

npm install yarn -g
• Install the Yeoman generator

npm install yo -g
• Install the JHipster generator

npm install -g generator-jhipster
• Create a new folder and cd to it
• Run JHipster and answer the questions

jhipster

JHipster can generate
• A monolithic app (Angular+Java inside the WAR)
• Microservices app (Angular inside a gateway
app and Java is a separate app)
• Entities for your CRUD app
Monolithic architecture
An Angular app is packaged in a WAR file
Angular

User Spring Boot



Java
Running a deployed monolithic app
To serve the deployed Angular app:



./mvnw

Angular

User
Spring Boot



Java
localhost:8080
To serve Angular client with hot reload:



yarn start
Running a monolithic app in dev
Angular

User
Webpack

dev server

localhost:9060
Java
Spring

Boot

localhost:8080
Generating a WAR file
• To package the app in a prod WAR file:



./mvnw -Pprod package
• You’ll get one executable WAR and another for an app
server:



target/hello-0.0.1-SNAPSHOT.war



target/hello-0.0.1-SNAPSHOT.war.original
Internationalization

ng2-translate
<h1 class="display-4" jhiTranslate="home.title">Welcome, Java Hipster!</h1>
<p class="lead" jhiTranslate="home.subtitle">This is your homepage</p>
webapp/app/shared/language
Demo

generating a monolith app
Adding entities with JDL-Studio
1.Define
2.Download

to a file
Importing entities
• Importing a model created in the JDL Studio:



yo jhipster:import-jdl ~/beers.jh 

• Adding an entity interactively:



yo jhipster:entity beer
Demo

generating entities
nginx.conf

with proxies
Angular

app
Google

maps

APIs
User
NGINX Web Server
Spring
Boot

instances

Another

Service

Would be nice to have
Feature request: https://github.com/jhipster/generator-jhipster/issues/5754
Sample microservices infrastructure
Source: https://jhipster.github.io/microservices-architecture
Gateway

8080
Consul

from HashiCorp

8500
User
Angular
Sample microservices infrastructure

with Consul discovery
Microservice 1

8081
Microservice 2

8082
To generate a microservices app,

run Hipster twice
• Create two directories - one for app and one for gateway
• In app dir:
• In gateway dir:
To start Microservices app 

Docker + Consul
• In terminal 1 (Consul on 8500): 

docker-compose -f src/main/docker/consul.yml up
• In terminal 2 (backend on 8081):

./mvnw
• In terminal 3 (gateway on 8080)

./mvnw
If you specified a DB during a microservice generation, 

start it using docker-compose
Deployment options
• Heroku
• AWS
• CloudFoundry
• Kubernetes
• Docker
• OpenShift
• Rancher
Links
• Spring Boot app serving 3 products:

https://github.com/yfain/springboot
• Using Angular with JHipster (docs):

https://jhipster.github.io/using-angular
• Angular training inquiries:
training@faratasystems.com
• My blog:

yakovfain.com

More Related Content

What's hot

Reactive Streams and RxJava2
Reactive Streams and RxJava2Reactive Streams and RxJava2
Reactive Streams and RxJava2Yakov Fain
 
RESTful services and OAUTH protocol in IoT
RESTful services and OAUTH protocol in IoTRESTful services and OAUTH protocol in IoT
RESTful services and OAUTH protocol in IoTYakov Fain
 
Automated Testing in Angular Slides
Automated Testing in Angular SlidesAutomated Testing in Angular Slides
Automated Testing in Angular SlidesJim Lynch
 
Building a Spring Boot Application - Ask the Audience! (from JavaLand 2017)
Building a Spring Boot Application - Ask the Audience!  (from JavaLand 2017)Building a Spring Boot Application - Ask the Audience!  (from JavaLand 2017)
Building a Spring Boot Application - Ask the Audience! (from JavaLand 2017)🎤 Hanno Embregts 🎸
 
The Many Ways to Test Your React App
The Many Ways to Test Your React AppThe Many Ways to Test Your React App
The Many Ways to Test Your React AppAll Things Open
 
Connecting Connect with Spring Boot
Connecting Connect with Spring BootConnecting Connect with Spring Boot
Connecting Connect with Spring BootVincent Kok
 
Spring boot introduction
Spring boot introductionSpring boot introduction
Spring boot introductionRasheed Waraich
 
Spring boot
Spring bootSpring boot
Spring bootsdeeg
 
Springboot and camel
Springboot and camelSpringboot and camel
Springboot and camelDeepak Kumar
 
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...Paul Jensen
 
E2E testing Single Page Apps and APIs with Cucumber.js and Puppeteer
E2E testing Single Page Apps and APIs with Cucumber.js and PuppeteerE2E testing Single Page Apps and APIs with Cucumber.js and Puppeteer
E2E testing Single Page Apps and APIs with Cucumber.js and PuppeteerPaul Jensen
 
Using React with Grails 3
Using React with Grails 3Using React with Grails 3
Using React with Grails 3Zachary Klein
 
An Overview of the React Ecosystem
An Overview of the React EcosystemAn Overview of the React Ecosystem
An Overview of the React EcosystemFITC
 
Wuff: Building Eclipse Applications and Plugins with Gradle
Wuff: Building Eclipse Applications and Plugins with GradleWuff: Building Eclipse Applications and Plugins with Gradle
Wuff: Building Eclipse Applications and Plugins with GradleAndrey Hihlovsky
 
AngularJS Unit Test
AngularJS Unit TestAngularJS Unit Test
AngularJS Unit TestChiew Carol
 
Testing nightwatch, by David Torroija
Testing nightwatch, by David TorroijaTesting nightwatch, by David Torroija
Testing nightwatch, by David TorroijaDavid Torroija
 

What's hot (20)

Reactive Streams and RxJava2
Reactive Streams and RxJava2Reactive Streams and RxJava2
Reactive Streams and RxJava2
 
RESTful services and OAUTH protocol in IoT
RESTful services and OAUTH protocol in IoTRESTful services and OAUTH protocol in IoT
RESTful services and OAUTH protocol in IoT
 
Automated Testing in Angular Slides
Automated Testing in Angular SlidesAutomated Testing in Angular Slides
Automated Testing in Angular Slides
 
Spring boot
Spring bootSpring boot
Spring boot
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
React JS
React JSReact JS
React JS
 
Building a Spring Boot Application - Ask the Audience! (from JavaLand 2017)
Building a Spring Boot Application - Ask the Audience!  (from JavaLand 2017)Building a Spring Boot Application - Ask the Audience!  (from JavaLand 2017)
Building a Spring Boot Application - Ask the Audience! (from JavaLand 2017)
 
The Many Ways to Test Your React App
The Many Ways to Test Your React AppThe Many Ways to Test Your React App
The Many Ways to Test Your React App
 
Connecting Connect with Spring Boot
Connecting Connect with Spring BootConnecting Connect with Spring Boot
Connecting Connect with Spring Boot
 
Spring boot introduction
Spring boot introductionSpring boot introduction
Spring boot introduction
 
Spring boot
Spring bootSpring boot
Spring boot
 
Springboot and camel
Springboot and camelSpringboot and camel
Springboot and camel
 
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
 
E2E testing Single Page Apps and APIs with Cucumber.js and Puppeteer
E2E testing Single Page Apps and APIs with Cucumber.js and PuppeteerE2E testing Single Page Apps and APIs with Cucumber.js and Puppeteer
E2E testing Single Page Apps and APIs with Cucumber.js and Puppeteer
 
Using React with Grails 3
Using React with Grails 3Using React with Grails 3
Using React with Grails 3
 
An Overview of the React Ecosystem
An Overview of the React EcosystemAn Overview of the React Ecosystem
An Overview of the React Ecosystem
 
Wuff: Building Eclipse Applications and Plugins with Gradle
Wuff: Building Eclipse Applications and Plugins with GradleWuff: Building Eclipse Applications and Plugins with Gradle
Wuff: Building Eclipse Applications and Plugins with Gradle
 
AngularJS Unit Test
AngularJS Unit TestAngularJS Unit Test
AngularJS Unit Test
 
Why I am hooked on the future of React
Why I am hooked on the future of ReactWhy I am hooked on the future of React
Why I am hooked on the future of React
 
Testing nightwatch, by David Torroija
Testing nightwatch, by David TorroijaTesting nightwatch, by David Torroija
Testing nightwatch, by David Torroija
 

Similar to Using JHipster for generating Angular/Spring Boot apps

Web worker in your angular application
Web worker in your angular applicationWeb worker in your angular application
Web worker in your angular applicationSuresh Patidar
 
NCDevCon 2017 - Cross Platform Mobile Apps
NCDevCon 2017 - Cross Platform Mobile AppsNCDevCon 2017 - Cross Platform Mobile Apps
NCDevCon 2017 - Cross Platform Mobile AppsJohn M. Wargo
 
Build your operator with the right tool
Build your operator with the right toolBuild your operator with the right tool
Build your operator with the right toolRafał Leszko
 
Angular kickstart slideshare
Angular kickstart   slideshareAngular kickstart   slideshare
Angular kickstart slideshareSaleemMalik52
 
Build Your Kubernetes Operator with the Right Tool!
Build Your Kubernetes Operator with the Right Tool!Build Your Kubernetes Operator with the Right Tool!
Build Your Kubernetes Operator with the Right Tool!Rafał Leszko
 
React Basic and Advance || React Basic
React Basic and Advance   || React BasicReact Basic and Advance   || React Basic
React Basic and Advance || React Basicrafaqathussainc077
 
Angular4 getting started
Angular4 getting startedAngular4 getting started
Angular4 getting startedTejinderMakkar
 
Quick introduction to Angular 4 for AngularJS 1.5 developers
Quick introduction to Angular 4 for AngularJS 1.5 developersQuick introduction to Angular 4 for AngularJS 1.5 developers
Quick introduction to Angular 4 for AngularJS 1.5 developersPaweł Żurowski
 
Angular meetup 2 2019-08-29
Angular meetup 2   2019-08-29Angular meetup 2   2019-08-29
Angular meetup 2 2019-08-29Nitin Bhojwani
 
Fullstack workshop
Fullstack workshopFullstack workshop
Fullstack workshopAssaf Gannon
 
Django simplified : by weever mbakaya
Django simplified : by weever mbakayaDjango simplified : by weever mbakaya
Django simplified : by weever mbakayaMbakaya Kwatukha
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for JavaLars Vogel
 
DevOps on AWS: Accelerating Software Delivery with the AWS Developer Tools
DevOps on AWS: Accelerating Software Delivery with the AWS Developer ToolsDevOps on AWS: Accelerating Software Delivery with the AWS Developer Tools
DevOps on AWS: Accelerating Software Delivery with the AWS Developer ToolsAmazon Web Services
 
Getting started with appium
Getting started with appiumGetting started with appium
Getting started with appiumPratik Patel
 
From MEAN to the MERN Stack
From MEAN to the MERN StackFrom MEAN to the MERN Stack
From MEAN to the MERN StackTroy Miles
 

Similar to Using JHipster for generating Angular/Spring Boot apps (20)

An Overview of Angular 4
An Overview of Angular 4 An Overview of Angular 4
An Overview of Angular 4
 
Web worker in your angular application
Web worker in your angular applicationWeb worker in your angular application
Web worker in your angular application
 
Angular Universal
Angular UniversalAngular Universal
Angular Universal
 
NCDevCon 2017 - Cross Platform Mobile Apps
NCDevCon 2017 - Cross Platform Mobile AppsNCDevCon 2017 - Cross Platform Mobile Apps
NCDevCon 2017 - Cross Platform Mobile Apps
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Angular IO
Angular IOAngular IO
Angular IO
 
Build your operator with the right tool
Build your operator with the right toolBuild your operator with the right tool
Build your operator with the right tool
 
Angular kickstart slideshare
Angular kickstart   slideshareAngular kickstart   slideshare
Angular kickstart slideshare
 
Build Your Kubernetes Operator with the Right Tool!
Build Your Kubernetes Operator with the Right Tool!Build Your Kubernetes Operator with the Right Tool!
Build Your Kubernetes Operator with the Right Tool!
 
React Basic and Advance || React Basic
React Basic and Advance   || React BasicReact Basic and Advance   || React Basic
React Basic and Advance || React Basic
 
Angular4 getting started
Angular4 getting startedAngular4 getting started
Angular4 getting started
 
Quick introduction to Angular 4 for AngularJS 1.5 developers
Quick introduction to Angular 4 for AngularJS 1.5 developersQuick introduction to Angular 4 for AngularJS 1.5 developers
Quick introduction to Angular 4 for AngularJS 1.5 developers
 
Angular meetup 2 2019-08-29
Angular meetup 2   2019-08-29Angular meetup 2   2019-08-29
Angular meetup 2 2019-08-29
 
Fullstack workshop
Fullstack workshopFullstack workshop
Fullstack workshop
 
Django simplified : by weever mbakaya
Django simplified : by weever mbakayaDjango simplified : by weever mbakaya
Django simplified : by weever mbakaya
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for Java
 
DevOps on AWS: Accelerating Software Delivery with the AWS Developer Tools
DevOps on AWS: Accelerating Software Delivery with the AWS Developer ToolsDevOps on AWS: Accelerating Software Delivery with the AWS Developer Tools
DevOps on AWS: Accelerating Software Delivery with the AWS Developer Tools
 
Getting started with appium
Getting started with appiumGetting started with appium
Getting started with appium
 
From MEAN to the MERN Stack
From MEAN to the MERN StackFrom MEAN to the MERN Stack
From MEAN to the MERN Stack
 
Android programming-basics
Android programming-basicsAndroid programming-basics
Android programming-basics
 

More from Yakov Fain

Web sockets in Angular
Web sockets in AngularWeb sockets in Angular
Web sockets in AngularYakov Fain
 
TypeScript for Java Developers
TypeScript for Java DevelopersTypeScript for Java Developers
TypeScript for Java DevelopersYakov Fain
 
Angular 4 for Java Developers
Angular 4 for Java DevelopersAngular 4 for Java Developers
Angular 4 for Java DevelopersYakov Fain
 
Reactive programming in Angular 2
Reactive programming in Angular 2Reactive programming in Angular 2
Reactive programming in Angular 2Yakov Fain
 
Angular2 Development for Java developers
Angular2 Development for Java developersAngular2 Development for Java developers
Angular2 Development for Java developersYakov Fain
 
Reactive Thinking in Java
Reactive Thinking in JavaReactive Thinking in Java
Reactive Thinking in JavaYakov Fain
 
Overview of the AngularJS framework
Overview of the AngularJS framework Overview of the AngularJS framework
Overview of the AngularJS framework Yakov Fain
 
Dart for Java Developers
Dart for Java DevelopersDart for Java Developers
Dart for Java DevelopersYakov Fain
 
Integrating consumers IoT devices into Business Workflow
Integrating consumers IoT devices into Business WorkflowIntegrating consumers IoT devices into Business Workflow
Integrating consumers IoT devices into Business WorkflowYakov Fain
 
Seven Versions of One Web Application
Seven Versions of One Web ApplicationSeven Versions of One Web Application
Seven Versions of One Web ApplicationYakov Fain
 
Running a Virtual Company
Running a Virtual CompanyRunning a Virtual Company
Running a Virtual CompanyYakov Fain
 
Princeton jug git_github
Princeton jug git_githubPrinceton jug git_github
Princeton jug git_githubYakov Fain
 
Speed up your Web applications with HTML5 WebSockets
Speed up your Web applications with HTML5 WebSocketsSpeed up your Web applications with HTML5 WebSockets
Speed up your Web applications with HTML5 WebSocketsYakov Fain
 
Surviving as a Professional Software Developer
Surviving as a Professional Software DeveloperSurviving as a Professional Software Developer
Surviving as a Professional Software DeveloperYakov Fain
 
Becoming a professional software developer
Becoming a professional software developerBecoming a professional software developer
Becoming a professional software developerYakov Fain
 

More from Yakov Fain (15)

Web sockets in Angular
Web sockets in AngularWeb sockets in Angular
Web sockets in Angular
 
TypeScript for Java Developers
TypeScript for Java DevelopersTypeScript for Java Developers
TypeScript for Java Developers
 
Angular 4 for Java Developers
Angular 4 for Java DevelopersAngular 4 for Java Developers
Angular 4 for Java Developers
 
Reactive programming in Angular 2
Reactive programming in Angular 2Reactive programming in Angular 2
Reactive programming in Angular 2
 
Angular2 Development for Java developers
Angular2 Development for Java developersAngular2 Development for Java developers
Angular2 Development for Java developers
 
Reactive Thinking in Java
Reactive Thinking in JavaReactive Thinking in Java
Reactive Thinking in Java
 
Overview of the AngularJS framework
Overview of the AngularJS framework Overview of the AngularJS framework
Overview of the AngularJS framework
 
Dart for Java Developers
Dart for Java DevelopersDart for Java Developers
Dart for Java Developers
 
Integrating consumers IoT devices into Business Workflow
Integrating consumers IoT devices into Business WorkflowIntegrating consumers IoT devices into Business Workflow
Integrating consumers IoT devices into Business Workflow
 
Seven Versions of One Web Application
Seven Versions of One Web ApplicationSeven Versions of One Web Application
Seven Versions of One Web Application
 
Running a Virtual Company
Running a Virtual CompanyRunning a Virtual Company
Running a Virtual Company
 
Princeton jug git_github
Princeton jug git_githubPrinceton jug git_github
Princeton jug git_github
 
Speed up your Web applications with HTML5 WebSockets
Speed up your Web applications with HTML5 WebSocketsSpeed up your Web applications with HTML5 WebSockets
Speed up your Web applications with HTML5 WebSockets
 
Surviving as a Professional Software Developer
Surviving as a Professional Software DeveloperSurviving as a Professional Software Developer
Surviving as a Professional Software Developer
 
Becoming a professional software developer
Becoming a professional software developerBecoming a professional software developer
Becoming a professional software developer
 

Recently uploaded

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 

Recently uploaded (20)

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 

Using JHipster for generating Angular/Spring Boot apps

  • 1. Using JHipster 4 for generating Angular/Spring Boot apps Yakov Fain Farata Systems
 yfain
  • 2. About myself • Work for Farata Systems • Java Champion • Latest book:
 “Angular Development with TypeScript”
  • 3. Agenda • Part 1 
 - Start a Spring Boot app that serves products
 - Generate a Web client with Angular CLI
 - Deploy the Angular app under Spring Boot • Part 2 
 - Generate an Angular/Spring Boot app with JHipster
 - Monolithic vs Microservices
 - Generating entities 
 - Internationalization
  • 4. Good frameworks make you write less code
  • 5. What’s Spring Boot? An opinionated runtime for Spring projects https://start.spring.io
  • 6. Our Spring Boot Controller @RestController
 @RequestMapping("/api")
 public class ProductController {
 
 Product products[] = new Product[3];
 
 ProductController(){
 products[0] = new Product(0,"First product", 59.99);
 products[1] = new Product(1,"Second product", 12.50);
 products[2] = new Product(2,"Third product", 14.40);
 }
 
 @RequestMapping(value="products",
 method = RequestMethod.GET,
 produces= MediaType.APPLICATION_JSON_VALUE)
 public Product[] getProducts(){
 return products;
 }
 }
  • 7. Demo • Start a Spring Boot App from the server dir
  • 8. What’s Angular? An opinionated platform for developing front- end of Web apps
  • 9. What’s Angular CLI? An opinionated tool that generates and bundles Angular projects
  • 10. @Component({ selector: 'app-root', template: `<h1>All Products</h1> <ul> <li *ngFor="let product of products"> {{product.title}} </li> </ul> `}) export class AppComponent { products: Array<string> = []; theDataSource: Observable<string>; constructor(private http: Http) { this.theDataSource = this.http.get('/api/products') .map(res => res.json()); } ngOnInit(){ this.theDataSource.subscribe( // Get the data from the Spring Boot server data => this.products=data, err => console.log(“Got and error. Code: %s, URL: %s ", err.status, err.url)); } } Our Angular Client Server’s
 endpoint
  • 11. Demo Generating a new Angular project called client to display products
  • 12. scripts": {
 "build": "ng build -prod",
 "postbuild": "npm run deploy",
 "predeploy": "rimraf ../server/src/main/resources/static && 
 mkdirp ../server/src/main/resources/static",
 "deploy": "copyfiles -f dist/** ../server/src/main/resources/ static" } Automating deployment with npm scripts static
 resources Spring
 Boot app Bundled 
 Angular app
  • 13. Adding packages for deployment to package.json "copyfiles": "^1.0.0", "mkdirp": "^0.5.1", "rimraf": "^2.5.4"
  • 14. Demo
 Our Angular app deployed in Spring Boot Java Angular
  • 15. When I was young... I just needed to learn a couple of tools
  • 16. Do you know all these? • Yeoman • npm • Yarn • Maven • Gradle • Docker • My SQL • H2 • Liquibase • JDL Studio • Webpack • SwaggerUI • Consul • Angular • Java • JavaScript • TypeScript • Spring • JWT • RESTFul Web services • JSON • HTML
  • 17. What’s Yeoman? An opinionated tool for kickstarting new Web projects and generating things
  • 18. What’s JHipster? • An opinionated Yeoman generator to generate, 
 develop, and deploy Spring Boot + Angular projects • Docs: https://jhipster.github.io • 500K downloads, 7300 stars on GitHub, 340 contributors
  • 19. Why use JHipster? • Generates a working Angular/Spring Boot in minutes • Automates the manual work • Shows best practices • Simplifies cloud deployment
  • 20. Getting started • Install node.js from https://nodejs.org • Install the Yarn package manager
 npm install yarn -g • Install the Yeoman generator
 npm install yo -g • Install the JHipster generator
 npm install -g generator-jhipster • Create a new folder and cd to it • Run JHipster and answer the questions
 jhipster

  • 21. JHipster can generate • A monolithic app (Angular+Java inside the WAR) • Microservices app (Angular inside a gateway app and Java is a separate app) • Entities for your CRUD app
  • 22. Monolithic architecture An Angular app is packaged in a WAR file Angular
 User Spring Boot
 
 Java
  • 23.
  • 24. Running a deployed monolithic app To serve the deployed Angular app:
 
 ./mvnw
 Angular
 User Spring Boot
 
 Java localhost:8080
  • 25. To serve Angular client with hot reload:
 
 yarn start Running a monolithic app in dev Angular
 User Webpack
 dev server
 localhost:9060 Java Spring
 Boot
 localhost:8080
  • 26. Generating a WAR file • To package the app in a prod WAR file:
 
 ./mvnw -Pprod package • You’ll get one executable WAR and another for an app server:
 
 target/hello-0.0.1-SNAPSHOT.war
 
 target/hello-0.0.1-SNAPSHOT.war.original
  • 27. Internationalization
 ng2-translate <h1 class="display-4" jhiTranslate="home.title">Welcome, Java Hipster!</h1> <p class="lead" jhiTranslate="home.subtitle">This is your homepage</p> webapp/app/shared/language
  • 29. Adding entities with JDL-Studio 1.Define 2.Download
 to a file
  • 30. Importing entities • Importing a model created in the JDL Studio:
 
 yo jhipster:import-jdl ~/beers.jh 
 • Adding an entity interactively:
 
 yo jhipster:entity beer
  • 32. nginx.conf
 with proxies Angular
 app Google
 maps
 APIs User NGINX Web Server Spring Boot
 instances
 Another
 Service
 Would be nice to have Feature request: https://github.com/jhipster/generator-jhipster/issues/5754
  • 33. Sample microservices infrastructure Source: https://jhipster.github.io/microservices-architecture
  • 34. Gateway
 8080 Consul
 from HashiCorp
 8500 User Angular Sample microservices infrastructure
 with Consul discovery Microservice 1
 8081 Microservice 2
 8082
  • 35. To generate a microservices app,
 run Hipster twice • Create two directories - one for app and one for gateway • In app dir: • In gateway dir:
  • 36. To start Microservices app 
 Docker + Consul • In terminal 1 (Consul on 8500): 
 docker-compose -f src/main/docker/consul.yml up • In terminal 2 (backend on 8081):
 ./mvnw • In terminal 3 (gateway on 8080)
 ./mvnw If you specified a DB during a microservice generation, 
 start it using docker-compose
  • 37. Deployment options • Heroku • AWS • CloudFoundry • Kubernetes • Docker • OpenShift • Rancher
  • 38. Links • Spring Boot app serving 3 products:
 https://github.com/yfain/springboot • Using Angular with JHipster (docs):
 https://jhipster.github.io/using-angular • Angular training inquiries: training@faratasystems.com • My blog:
 yakovfain.com