osx sierra intellij spring boot jdk 8 slow startup

My spring boot applications startup time was very long with jdk 8. There is no problem with jdk 9. A simple application without any code startup time was over 15 seconds. Now it starts under 5 seconds. I find solution in stackoverflow :

solved the problem by adding my Mac hostname (i.e. Macbook.local, or whatever your Mac is called) on the /etc/hosts file mapped to the address as well as the ::1 like this:   localhost mbpro.local
::1         localhost mbpro.local

To learn your hostname, type hostname in the console.



Integrating Angular and Spring Boot in one project and running on one server


  1. After creating spring boot project to create Angular project on the same folder :
    From root directory firstly go upper directory

    cd ..

    create new ng project with same spring boot directory name (example: bootang) , and i set src/main/app for Angular source

    ng new bootang -sd src/main/app
  2. Change output directory for Angular output in .angular-cli.json :
    "outDir": "src/main/webapp",
  3. Build angular app :
    ng build

    If you run with -w (watch) parameter, it will refresh angular build files.
    Like ng serve

    ng build -w
  4. Run your spring boot application and you will see Spring Boot and Angular runs on same server (default localhost:8080)I think this way is better/simple than JHipster ‘s lots of webpack configuration 🙂

Hibernate Auditing – Base Entity and Example Entity

Add @EnableJpaAuditing to spring boot config class

public class AppConfiguration {

Add Hibernate envers dependency to your pom.xml file :


This is base entity class for enabling auditing :

public class BaseEntity implements Serializable{

    private static final long serialVersionUID = -1591130256151148932L;

    private String createdBy;

    private Date createdDate;

    private String updatedBy;

    private Date updatedDate;

Example User entity extends BaseEntity :

public class User extends BaseEntity implements Serializable {

    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    @Column(length = 100,unique = true,nullable = false)
    private String login;

    private String password;
    private String firstName;
    private String lastName;
    private boolean active = false;
    private String email;

    @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)
    private Set<Role> roles = new HashSet<>();

If a relationship entity in your entity is not audited, then you should add annotation  :
@Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)

For adding for example “ZLOG_” prefix to your audit tables in your spring boot application.yml file :

      org.hibernate.envers.audit_table_prefix: ZLOG_