Generating eventsearch backbone with jhipster generator tutorial


Let’s start to create backbone of our application in jhipster. In this part we will focus on setup environment and have a fun with jhipster console generator.

Spis treści

Setup part

At the beginning we need to configure some libraries. I hope you have your java JDK, basic groovy and node js installed.

npm install -g yo

Installation of yeoman – scaffolding tool which help us generate whole structure.

npm install -g bower

Installation of bower – package manager, which will download all libs, such as jquery.

npm install -g grunt-cli

Javascript task runner, you can use it for exampe for minification css.

npm install -g generator-jhipster

And jHipster generator is on your desk.

 

Prepare database for application

We need to install Postgres database with pgAdmin. After installation we want to create new user, new database and grant user access to the database.

create database evsdb;
CREATE DATABASE
Query returned successfully in 3 secs.

create user evsuser with password 'pwdevs';
CREATE ROLE
Query returned successfully in 499 msec.

grant all privileges on database evsdb to evsuser;
GRANT
Query returned successfully in 708 msec.

 

Run jHipster generator

You will have 15 questions how should look like your application. You need to choose type of application (eg. standard monolithic), app name, namespace name, type of authentication, caching, type of angular (I’ve choosed 1.x angular because I’ve been using it a long time ago and for this app will be enought) and lot’s more. Please take a look at console sceenshot from jhipster generator below (please open it as image in new tab).

I’ve also installed some additional modules to check what it is. Probably they are useless for now, but maybe some day I will use them or clean it up 😉

 

? (1/15) Which *type* of application would you like to create? Monolithic application (recommended for simple projects)
? (2/15) What is the base name of your application? eventsearch
? (3/15) Would you like to install other generators from the JHipster Marketplace? Yes
? Which other modules would you like to use? (generator-jhipster-bootstrap-material-design-3.5.1) Add Material design to your JHipster application [Thibaut Mottet], (generator-jhipster-spring-social-connectors-0.0.1) Add Spring social connector to your JHips
ter application [Thibaut Mottet], (generator-jhipster-elasticsearch-reindexer-0.3.0) Generate a service for reindexing all database rows for each of your entities [Gerald Humphries], (generator-jhipster-material-0.0.0) A Jhipster based generator to create An
gular material + spring boot application [Deepu KS], (generator-jhipster-fortune-0.0.2) Sample JHipster module, generates a "fortune cookie" page in your JHipster application [Julien Dubois], (generator-jhipster-google-analytics-0.0.1) Install Google analyti
cs on your JHipster app [Thibaut Mottet], (generator-jhipster-google-maps-0.0.1) Install Google maps sample on your JHipster app [Thibaut Mottet]
? (4/15) What is your default Java package name? com.pdb.eventsearch
? (5/15) Which *type* of authentication would you like to use? JWT authentication (stateless, with a token)
? (6/15) Which *type* of database would you like to use? SQL (H2, MySQL, MariaDB, PostgreSQL, Oracle, MSSQL)
? (7/15) Which *production* database would you like to use? PostgreSQL
? (8/15) Which *development* database would you like to use? PostgreSQL
? (9/15) Do you want to use Hibernate 2nd level cache? Yes, with ehcache (local cache, for a single node)
? (10/15) Would you like to use Maven or Gradle for building the backend? Gradle
? (11/15) Which other technologies would you like to use? Social login (Google, Facebook, Twitter), Search engine using Elasticsearch, WebSockets using Spring Websocket
? (12/15) Which *Framework* would you like to use for the client? AngularJS 1.x
? (13/15) Would you like to use the LibSass stylesheet preprocessor for your CSS? No
? (14/15) Would you like to enable internationalization support? Yes
? Please choose the native language of the application? English
? Please choose additional languages to install Polish
? (15/15) Besides JUnit and Karma, which testing frameworks would you like to use?
(*) Gatling
(*) Cucumber
>(*) Protractor

Now we need to prepare all files in frontend to works fine using:

npm install && bower install

And change database credential in application-dev.yml file:

datasource:
    type: com.zaxxer.hikari.HikariDataSource
    url: jdbc:postgresql://tst.paweldobrzanski.pl:5432/evsdb
    username: evsuser
    password: pwdevs

 

Run generated jHipster application

gradlew bootRun
> Building 92% > :bootRun
         ??? ???   ??? ????????? ????????   ??????? ????????? ????????? ????????
        ??? ???   ??? ????????? ????????? ???????? ????????? ????????? ?????????
        ??? ?????????    ???    ????????? ???????     ???    ???????   ?????????
  ???   ??? ?????????    ???    ????????   ???????    ???    ???????   ????????
  ????????? ???   ??? ????????? ???       ????????    ???    ????????? ???  ????
   ???????  ???   ??? ????????? ???       ???????     ???    ????????? ???   ???

:: JHipster ?  :: Running Spring Boot 1.5.2.RELEASE ::
:: http://jhipster.github.io ::

2017-03-14 22:16:39.529  INFO 10928 --- [  restartedMain] com.pdb.eventsearch.EventsearchApp       : Starting EventsearchApp on DC6L7P72 with PID 10928 (C:\hip\eventsearch\build\classes\main started by SG0953431 in C:\hip\eventsearch)
2017-03-14 22:16:39.531 DEBUG 10928 --- [  restartedMain] com.pdb.eventsearch.EventsearchApp       : Running with Spring Boot v1.5.2.RELEASE, Spring v4.3.7.RELEASE
2017-03-14 22:16:39.531  INFO 10928 --- [  restartedMain] com.pdb.eventsearch.EventsearchApp       : The following profiles are active: swagger,dev
2017-03-14 22:16:40.277 DEBUG 10928 --- [kground-preinit] org.jboss.logging                        : Logging Provider: org.jboss.logging.Slf4jLoggerProvider found via system property
2017-03-14 22:16:43.708 DEBUG 10928 --- [  restartedMain] c.p.e.config.AsyncConfiguration          : Creating Async Task Executor
2017-03-14 22:16:44.513 DEBUG 10928 --- [  restartedMain] c.e.c.E.pdb.eventsearch.domain.User      : Initialize successful.
2017-03-14 22:16:44.524 DEBUG 10928 --- [  restartedMain] c.e.c.E.p.eventsearch.domain.Authority   : Initialize successful.
2017-03-14 22:16:44.529 DEBUG 10928 --- [  restartedMain] c.e.c.E.p.e.domain.User.authorities      : Initialize successful.
2017-03-14 22:16:44.533 DEBUG 10928 --- [  restartedMain] c.e.c.E.p.e.domain.SocialUserConnection  : Initialize successful.
2017-03-14 22:16:44.742 DEBUG 10928 --- [  restartedMain] c.p.e.config.MetricsConfiguration        : Registering JVM gauges
2017-03-14 22:16:44.768 DEBUG 10928 --- [  restartedMain] c.p.e.config.MetricsConfiguration        : Monitoring the datasource
2017-03-14 22:16:44.769 DEBUG 10928 --- [  restartedMain] c.p.e.config.MetricsConfiguration        : Initializing Metrics JMX reporting
2017-03-14 22:16:45.623 DEBUG 10928 --- [  restartedMain] c.pdb.eventsearch.config.WebConfigurer   : Registering CORS filter
2017-03-14 22:16:45.762  INFO 10928 --- [  restartedMain] c.pdb.eventsearch.config.WebConfigurer   : Web application configuration, using profiles: swagger
2017-03-14 22:16:45.763 DEBUG 10928 --- [  restartedMain] c.pdb.eventsearch.config.WebConfigurer   : Initializing Metrics registries
2017-03-14 22:16:45.771 DEBUG 10928 --- [  restartedMain] c.pdb.eventsearch.config.WebConfigurer   : Registering Metrics Filter
2017-03-14 22:16:45.773 DEBUG 10928 --- [  restartedMain] c.pdb.eventsearch.config.WebConfigurer   : Registering Metrics Servlet
2017-03-14 22:16:45.777  INFO 10928 --- [  restartedMain] c.pdb.eventsearch.config.WebConfigurer   : Web application fully configured
2017-03-14 22:16:46.075 DEBUG 10928 --- [  restartedMain] c.p.e.config.DatabaseConfiguration       : Configuring Liquibase
2017-03-14 22:16:46.085  WARN 10928 --- [arch-Executor-1] i.g.j.c.liquibase.AsyncSpringLiquibase   : Starting Liquibase asynchronously, your database might not be ready at startup!
2017-03-14 22:16:47.974 DEBUG 10928 --- [arch-Executor-1] i.g.j.c.liquibase.AsyncSpringLiquibase   : Started Liquibase in 1887 ms
2017-03-14 22:16:49.849 DEBUG 10928 --- [  restartedMain] c.p.e.config.social.SocialConfiguration  : Configuring GoogleConnectionFactory
2017-03-14 22:16:49.857 DEBUG 10928 --- [  restartedMain] c.p.e.config.social.SocialConfiguration  : Configuring FacebookConnectionFactory
2017-03-14 22:16:49.859 DEBUG 10928 --- [  restartedMain] c.p.e.config.social.SocialConfiguration  : Configuring TwitterConnectionFactory
2017-03-14 22:16:58.108 DEBUG 10928 --- [  restartedMain] i.g.j.c.apidoc.SwaggerConfiguration      : Starting Swagger
2017-03-14 22:16:58.120 DEBUG 10928 --- [  restartedMain] i.g.j.c.apidoc.SwaggerConfiguration      : Started Swagger in 11 ms
2017-03-14 22:16:59.932  INFO 10928 --- [  restartedMain] com.pdb.eventsearch.EventsearchApp       : Started EventsearchApp in 21.426 seconds (JVM running for 21.917)
2017-03-14 22:16:59.934  INFO 10928 --- [  restartedMain] com.pdb.eventsearch.EventsearchApp       :
----------------------------------------------------------
       Application 'eventsearch' is running! Access URLs:
     Local:          https://tst.paweldobrzanski.pl:8080
  External:       http://192.168.0.8:8080
        Profile(s):     [swagger, dev]
----------------------------------------------------------
2017-03-14 22:20:24.905 DEBUG 10928 --- [  XNIO-2 task-9] c.p.e.aop.logging.LoggingAspect          : Enter: com.pdb.eventsearch.web.rest.ProfileInfoResource.getActiveProfiles() with argument[s] = []
2017-03-14 22:20:24.917 DEBUG 10928 --- [  XNIO-2 task-9] c.p.e.aop.logging.LoggingAspect          : Exit: com.pdb.eventsearch.web.rest.ProfileInfoResource.getActiveProfiles() with result = com.pdb.eventsearch.web.rest.ProfileInfoResource$ProfileInfoVM@1d41be
aa
2017-03-14 22:20:24.921 DEBUG 10928 --- [ XNIO-2 task-11] c.p.e.aop.logging.LoggingAspect          : Enter: org.springframework.boot.actuate.audit.AuditEventRepository.add() with argument[s] = [AuditEvent [timestamp=Tue Mar 14 22:20:24 CET 2017, principal=ano
nymousUser, type=AUTHORIZATION_FAILURE, data={details=org.springframework.security.web.authentication.WebAuthenticationDetails@b364: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: null, type=org.springframework.security.access.AccessDeniedException, message=Acc
ess is denied}]]
2017-03-14 22:20:24.922 DEBUG 10928 --- [ XNIO-2 task-11] c.p.e.aop.logging.LoggingAspect          : Exit: org.springframework.boot.actuate.audit.AuditEventRepository.add() with result = null
2017-03-14 22:20:24.925 DEBUG 10928 --- [ XNIO-2 task-11] i.g.j.s.Http401UnauthorizedEntryPoint    : Pre-authenticated entry point called. Rejecting access
> Building 92% > :bootRun

And it’s working!!!

Rigth now we have simple application with

  • ability to login and register,
  • internationalization is being enabled
  • looks cool with bootstrap – material design…oh what?
  • has a lot of stuff in admin mode 🙂

One more thing: material design. We need to generete it!

yo jhipster-bootstrap-material-design

 

In next tutorial we will be generating application model, see you next week!

Paweł Dobrzański

Start-up's fan, technological conferences member, social media enthusiast and low-cost trips traveler.

You may also like

LEAVE A COMMENT

Cześć!

Witaj na moim blogu! Znajdziesz tu proces budowania mojej aplikacji EventSearch za pomocą jhipstera. Podzielę się z Tobą niuansami dot. zakładania i prowadzenia firmy. Mam również nadzieję, że pomogę Ci zaoszczędzić trochę pieniędzy. Zapraszam!

Najpopularniejsze posty

Dzięki, że wpadłeś!

Paweł Dobrzański

Paweł Dobrzański

Start-up's fan, technological conferences member, social media enthusiast and low-cost trips traveler.