JHipster 6 Demo Steps

The brackets at the end of each step indicate the alias’s or IntelliJ Live Templates to use. You can find the template definitions at mraible/idea-live-templates.

Create JHipster Project

  1. Create a blog directory and create a JHipster app in it

    name: blog
    package: org.jhipster.blog
    authenticationType: JWT
    prodDatabaseType: PostgreSQL
    languages: en,es
    testFrameworks: Protractor
  2. Start app using ./mvnw, browse through admin features

  3. Confirm everything works by running Protractor

Generate Entities

  1. Import Blog JDL from start.jhipster.tech

    jhipster import-jdl blog.jdl
  2. Restart application and show pre-loaded data

  3. Turn off faker in application-dev.yml and run ./mvnw clean

  4. Create a couple of blogs and entries for admin and user

  5. Show how admin and user share data

Add Business Logic

  1. Edit BlogResource.java and change getAllBlogs() method

    return blogRepository.findByUserIsCurrentUser()
  2. Show how blog list screen limits data to current user

  3. Edit EntryResource.java and change getAllEntries() [jh-findBy]

    page = entryRepository.findByBlogUserLoginOrderByDateDesc(SecurityUtils.getCurrentUserLogin().orElse(null), pageable);
  4. Using your IDE, create this method in EntryRepository

  5. Recompile both classes and verify entries are limited to current user

Make UI Enhancements

  1. Allow HTML in entries with [innerHTML]="entry.content"

  2. Improve entry layout to look like a blog [jh-entries]

Lock it down!

  1. Add logic to BlogResource#getBlog to make sure user owns blog [jh-get]

Deploy to the Cloud

  1. Build for production

    ./mvnw -Pprod verify
  2. Fix test failures with @WithMockUser and by setting a User on a blog by default

    private UserRepository userRepository;
    public Blog createEntity(EntityManager em) {
        Blog blog = new Blog()
        return blog;
  3. Run build again

  4. Login to Heroku using heroku login

  5. Run jhipster heroku

  6. When process completes, run heroku open

  7. Fini!