Welcome, Java Hipsters!


Spring + AngularJS + many more in one handy generator


Deepu K Sasidharan

Solution Designer @ Tata Consultancy Services


What is this all about?

Modern Web application development

Modern Web apps

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

  • Beautiful design (Unfortunately we live in a Beauty over Brains world!)
  • Stop waiting for pages to load
  • Dynamic updates of page fragments
  • Quick time to market

We need the latest HTML5/CSS3/JavaScript technologies

Developer productivity

Those webapps 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 webapps should be able to handle huge numbers of concurrent users

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

It should be production ready out of the box

We need robust, high-performance servers

Our goal is to solve those issues

  • A beautiful and customizable 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/Gulp, Bower, Karma, AngularJS, Bootstrap


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/Gulp 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/Less code...
							grunt test | gulp 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
  • 2 way data binding, form validation, custom elements, 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/Gradle, Spring, Spring MVC REST, Spring Data JPA, Spring Security


The most popular Java build tools
(Ant is dead :P )

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

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 though!


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 you 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 anyway
  • 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?

We've seen lots of cool technologies

  • Can Grunt and Maven be friends?
  • Can AngularJS and Spring MVC REST be friends?
  • 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 tables to AngularJS front end
  • "service" sub-generator to generate a Spring business service
  • "languages" sub-generator to add new i18n language support (18 out of the box)
  • 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
  • HTML, JavaScript & CSS optimization and minification
  • Executable or standard WAR file, with monitoring enabled
  • "heroku", "openshift", "cloudfoundry" sub-generators for deploying automatically to cloud (AWS is on the way)

Wait there's even more!

Meet JHipster-UML

  • Generate entities from UML model
  • Use your favorite UML tool or JDL(Jhipster Domain Language)
  • Modelio, UML Designer, GenMyModel and Visual Paradigm supported out of box
  • Easy to extend parser for other tools

Let's build our first app

10 minutes tutorial

Install Dependencies

Install Node.js and run below commands from CMD

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

Create an application

yo jhipster
mvn spring-boot:run | gradlew bootrun

Client-side live reload

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

grunt serve | gulp serve

Add an entity

yo jhipster:entity foo

Run in production

mvn -Pprod package | gradlew -Pprod bootRepackage
cd target/ | cd build/libs/
java -jar jhipster-0.0.1-SNAPSHOT.war --spring.profiles.active=prod

Complete Stack & Features OOB

Client Side

  • HTML Framework: HTML5 Boilerplate
  • CSS Framework: Bootstrap 3 (Saas supported with compass)
  • MVC Framework: Angular JS
  • i18N: Angular Translate (18 language supported OOB), i18n can be optional
  • Websocket: sock-js, stomp
  • HTML Templates: Thymeleaf

Server Side

  • Framework: Spring Boot
  • Security: Spring Security (session, Oauth2, Token)
  • MVC Framework: Spring MVC REST + Jackson
  • SQL DAO: MySQL/Posgres/Oracle + Spring Data JPA + Bean Validation + JPA + Hibernate
  • NoSQL DAO: MongoDB or Cassandra with custom wrapper implementations
  • DB management: Liquibase (DB version control)
  • Cache: EhCache or Hazelcast
  • Logging: Logback with runtime configuration
  • Monitoring: Metrics
  • Connection pooling: HikariCP
  • API Docs: Swagger2

Other features

  • Client side testing: KarmaJS + PhantomJS + Angular Mocks + Grunt/Gulp
  • Server Side Testing: JUnit + Spring Boot-Test + Mockito & Gatling(performance testing)
  • Client Side Build: Grunt/Gulp + bower for dependency management
  • Server Side Build: Maven/Gradle (Integrated with client side build task and test tasks)
  • Other features: Gzip filters, cache headers, Live reload, browser sync, session clustering, spring profiles, validation etc.

Real world application & Challenges

Enterprise buy in

  • Traditional Application server eco system
  • Integration with legacy systems
  • Complex Role Mangement scenarios

Developer buy in

  • Continuous Integration
  • Too much of Spring and Angular magic
  • Fear of the unknown


Thank you for your attention

Original presentation from http://jhipster.github.io by Julien Dubois