Welcome, Java Hipster

Yeoman + Maven + Spring + AngularJS in one handy generator


Press the right arrow to continue >

About this presentation

  • Hit the left/right arrow to browse to the main sections
  • Hit the up/down arrow to see the slides in each section
  • Hit the "escape" key to see all the slides

What is this all about?

Modern Web application development

Modern Web apps

End-users requirements have evolved. People are tired of slow, unreactive Web sites. They want:

  • Beautiful design
  • Stop waiting for pages to load
  • Dynamic updates of page fragments

We need to use the latest HTML5/CSS3/JavaScript technologies

Developer productivity

Those websites should be delivered fast.

Waiting 1 minute for your application to "deploy" is not acceptable anymore

We need the right tools for this job!

Production-ready software

Modern websites should be able to handle huge numbers of concurrent users

All using massive RESTful applications, which will hit your back-end servers hard

We need robust, high-performance servers

Our goal is to solve those issues

  • A beautiful front-end, with the latest HTML5/CSS3/JavaScript frameworks
  • A robust and high-quality back-end, with the latest Java/Caching/Data access technologies
  • All automatically wired up, with security and performance in mind
  • And great developer tooling, for maximum productivity

Client-side technologies

Yeoman, Grunt, Bower, AngularJS


Yeoman provides application generators

  • Hundreds of generators are available
  • Mostly geared toward JavaScript front-end applications
  • The top-rated generators have excellent quality
							yo jhipster


Grunt is a JavaScript task runner

  • For development, it will allow you to have "live editing" of your code, run your tests in the background...
  • For production, it will compress and optimize all your resources, compile your Sass code...
							grunt test


Bower is a package manager for your JavaScript assets

  • You can search, install and update your JavaScript libraries
  • It provides a huge number of libraries
							bower install angular


Karma runs unit tests on your JavaScript code

  • It works with Phantom.js, a headless browser
  • It is very fast, and can run continously in the background
							karma start src/test/javascript/karma.conf.js


The most popular JavaScript framework

  • Powerful & easy to learn
  • Data binding, form validation, i18n... all out of the box

Hello {{yourName}}!

Twitter Bootstrap

Great CSS/JavaScript framework for responsive Web apps

  • CSS and HTML elements for all common usages
  • Tons of JavaScript components: menus, navbars, drop-down boxes, alerts...
Hello, world!

Server-side technologies

Maven, Spring, Spring MVC REST, Spring Data JPA


The most popular Java build tool

  • Well-known, pre-defined directories and goals
  • Integration with major IDEs
  • Great plugin ecosystem, including Spring Boot and Yeoman
mvn spring-boot:run

Spring Boot

Spring is the de-facto standard for Java apps

  • IoC, AOP and abstractions to ease application coding
  • Fast and lightweight, and extremely powerful when needed
  • Out-of-the-box configuration by Spring Boot
public class UserService {

    private UserRepository userRepository;



Database updates made easy

  • Handles updating a database schema
  • Works great with Spring and JPA
  • Needs a good understanding of databases and ORM


The standard ORM solution for Java

  • Hibernate is used underneath
  • Very complete, impressive set of features
  • Still complex to understand for newbies!
public class User implements Serializable {

    private String login;


Spring Data JPA

Adds extra syntaxic sugar on top of JPA

  • Generate your JPA repositories automatically
  • Removes a lot of boilerplate code
public interface PersistenceAuditEventRepository extends JpaRepository<PersistentAuditEvent, String> {

        findByPrincipalAndAuditEventDateGreaterThan(String principal, LocalDateTime after);



NoSQL for scalability

  • Alternative to the SQL database and JPA choice
  • Similar code: Spring Data MongoDB works the same as Spring Data JPA
  • More scalable, easier to use


NoSQL for scalability

  • 2nd alternative to the SQL database and JPA choice
  • Linear scalability and high availability
  • Extreme performance and low latency for mission-critical apps


Caching is king for performance

  • Ehcache is the most widely used solution
  • HazelCast is a great alternative, with clustering support!
  • Hibernate 2nd level cache or Spring Caching abstraction
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class User implements Serializable {


Spring Security

Bulletproof Security framework

  • Leading tool, widely used across all industries
  • Secures URLs and Java code (Spring Beans)
  • Works both with stateful (cookies) and stateless (OAuth2) Web application architectures


The best REST framework in Java

  • Complete, high-performance REST solution
  • Great Spring support, great testing support
public class AccountResource {
    @RequestMapping(value = "/app/rest/account",
            method = RequestMethod.POST)
    public void saveAccount(@RequestBody UserDTO userDTO) {


Server-side templates

  • Used when a Single Web Page application isn't enough
  • Replaces JSPs and JSTLs, which are outdated and deprecated
  • Great templates for Web designers

Hello, world


Ready for production with Metrics

  • Formerly Yammer Metrics
  • Monitors the JVM, app server, Spring beans, cache, and more!
  • JMX or Graphite reporting
public void saveAccount(@RequestBody UserDTO userDTO) {

Cloud deployment

To the cloud and beyond!

  • Deployments should be easy on-premise and in the cloud
  • Leading cloud providers like Cloud Foundry, Heroku and OpenShift all provide specific tooling and deployment options

Meet JHipster

Why all the hype?

You said hype?

At the time of this writing (05/2015), the project is 18 months old:

  • We have 2,169 GitHub stars and 119 contributors
  • We are the 3rd most popular Yeoman generator
  • We have 250K page views this month
  • We've been featured on Websites everywhere (Infoworld, SD Times, JavaWorld, Reddit...)
  • And it's growing rapidly


We've seen lots of cool technologies

  • Can Grunt and Maven be friends?
  • Can AngularJS and Spring MVC REST be friends?
  • We can guarantee you that having everything working together smoothly, with security, caching and monitoring, isn't easy...

JHipster makes everything just work together

  • JHipster creates a complete working application, with all those technologies
  • Everthing just works out-of-the-box
  • You have your Yeoman workflow working great with your Maven goals!

But wait, there's more!

  • "entity" sub-generator to generate a complete JPA entity, from database to AngularJS
  • "service" sub-generator to generate a Spring business service
  • Great support for Spring Security: Ajax endpoints, secured remember-me, audits...
  • Great monitoring screen using Metrics


  • Specific Spring profile with GZipping and HTTP caching headers
  • JavaScript & CSS optimization and minification by Grunt
  • Executable or standard WAR file, with monitoring enabled
  • Sub-generators for deploying automatically to Cloud Foundry, Heroku and OpenShift

Let's build our first app

10 minutes tutorial

Install Yeoman

npm install -g yo
npm install -g generator-jhipster

Create an application

yo jhipster
mvn spring-boot:run

Client-side live reload

Live reload of your client-side code (HTML, CSS, JavaScript) works thanks to Grunt. Edit any file and your browser will refresh automatically:

grunt serve

Add an entity

yo jhipster:entity foo

Run in production

mvn -Pprod package
cd target/
java -jar jhipster-0.0.1-SNAPSHOT.war --spring.profiles.active=prod

Thank you for your attention