# jhipster 맛보기

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

# jhipster란

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

  • Spring boot를 이용한 생산성을 향상된 튼튼한 자바 스택 서버 사이드
  • AngularJS와 Bootstrap을 이용한 모던하고 모바일에 적합한 프론트 앤드
  • Yeoman, Bower, Grunt, Maven을 이용한 파워풀한 빌드 툴들

을 이용한 모던 웹앱을 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


  • maven 경우
$mvn 혹은 $ mvn spring-boot:run
  • gradle 경우
$ ./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?
name (String)
Generating field #2
? Do you want to add a field to your entity? No
name (String)
Generating relationships with other entities
? Do you want to add a relationship to another entity? No
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

# 결론

  • yeoman generator는 진짜 무궁무진 한것 같다.

  • 기존 MEAN 스택 관련은 몇몇가지 프로젝트를 본 적 있는데, 개인적으로는 spring-boot를 좋아하는 지라 맘에 든다.

  • AngularJS 뿐만 아니라 요즘 뜨고 있는 React도 되면 좋을것 같다.

  • Gradle, Gulp도 지원하긴 하지만 recommended 는 Maven과 Grunt.. 크게 트랜디 한 것 같진 않다.

  • 프로젝트 열어보면 뭐 엄청 복잡해 보이는데 그만큼 기본 제공하는 기능들이 많다.

# sample app

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