jhipster 맛보기


트위터 이것저것 보다가 @JHipster를 발견하였다.

My helpful screenshot

젠킨스 아저씨가 떠오르는 이 로고때문에 다시 돌아봤던 것 같다 ㅎㅎ

jhipster란

페이지 : http://jhipster.github.io/

을 이용한 모던 웹앱을 Generator 이다.

일단 만들어보자

1.yeoman & generator-jhipster 설치

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

2.JHipster yeoman으로 generate

yo jhipster

generate 이전에 몇몇 meta 정보/빌드툴에 대한 입력 및 선택이 진행 된다. (아래는 예시이다.)

? (1/15) What is the base name of your application? (jhipster)
? (2/15) What is your default Java package name? (com.mycompany.myapp)
? (3/15) Do you want to use Java 8? Yes (use Java 8)
? (4/15) Which *type* of authentication would you like to use? HTTP Session Authentication (stateful, default Spring Security mechanism)
? (5/15) Which *type* of database would you like to use? SQL (H2, MySQL, PostgreSQL, Oracle)
? (6/15) Which *production* database would you like to use? MySQL
? (7/15) Which *development* database would you like to use? H2 in-memory with Web console
? (8/15) Do you want to use Hibernate 2nd level cache? Yes, with ehcache (local cache, for a single node)
? (9/15) Do you want to use a search engine in your application? No
? (10/15) Do you want to use clustered HTTP sessions? No
? (11/15) Do you want to use WebSockets? No
? (12/15) Would you like to use Maven or Gradle for building the backend? Maven
? (13/15) Would you like to use Grunt or Gulp.js for building the frontend? Grunt (recommended)
? (14/15) Would you like to use the LibSass stylesheet preprocessor for your CSS? No
? (15/15) Would you like to enable translation support with Angular Translate? (Y/n) y

3.실행하기

$mvn 혹은 $ mvn spring-boot:run
$ ./gradlew 혹은 $ ./gradlew bootRun

localhost:8080 로 실행 확인!

4.client side live reload

$ grunt serve

Entity 더해보기

yeoman으로 엔티티도 추가할 수 있다.

$ yo jhipster:entity foo
he entity foo is being created.
Generating field #1
? Do you want to add a field to your entity? Yes
? What is the name of your field? name
? What is the type of your field? String
? Do you want to add validation rules to your field? Yes
? Which validation rules do you want to add?
=================Foo=================
name (String)
Generating field #2
? Do you want to add a field to your entity? No
=================Foo=================
name (String)
Generating relationships with other entities
? Do you want to add a relationship to another entity? No
===========Foo==============
name (String)
-------------------
? Do you want to use a Data Transfer Object (DTO)? [BETA] Yes, generate a DTO with MapStruct
? Do you want pagination on your entity? Yes, with a simple pager
Everything is configured, generating the entity...
   create .jhipster/Foo.json
   create src/main/java/net/jiyeon/demo/domain/Foo.java
   create src/main/java/net/jiyeon/demo/repository/FooRepository.java
   create src/main/java/net/jiyeon/demo/web/rest/FooResource.java
   create src/main/java/net/jiyeon/demo/web/rest/dto/FooDTO.java
   create src/main/java/net/jiyeon/demo/web/rest/mapper/FooMapper.java
   create src/main/resources/config/liquibase/changelog/20151012163422_added_entity_Foo.xml
   create src/main/webapp/scripts/app/entities/foo/foos.html
   create src/main/webapp/scripts/app/entities/foo/foo-detail.html
   create src/main/webapp/scripts/app/entities/foo/foo-dialog.html
   create src/main/webapp/scripts/app/entities/foo/foo.js
   create src/main/webapp/scripts/app/entities/foo/foo.controller.js
   create src/main/webapp/scripts/app/entities/foo/foo-dialog.controller.js
   create src/main/webapp/scripts/app/entities/foo/foo-detail.controller.js
   create src/main/webapp/scripts/components/entities/foo/foo.service.js
   create src/test/java/net/jiyeon/demo/web/rest/FooResourceTest.java
   create src/test/gatling/simulations/FooGatlingTest.scala
   create src/main/webapp/i18n/en/foo.json
   create src/main/webapp/i18n/fr/foo.json

결론

– Swagger2 : http://localhost:8080/#/docs

– SpringLiquibase

– Application metrics : http://localhost:8080/#/metrics

sample app

github : https://github.com/jhipster/jhipster-sample-app