読者です 読者をやめる 読者になる 読者になる

JHipsterを使って、AngularとSpring Bootのアプリケーションテンプレートを作成する

TL;DR

  1. JHipsterとは、Yeoman Generatorの一種
  2. Angular1とSpring Bootを利用したWEBアプリのテンプレートを作成できる
  3. Swagger/Liquibase/SonarQube等の開発サポート機構も組み込まれている

テンプレート作成コマンド

brew install node@6
npm i -g yarn
yarn global add bower gulp yo generator-jhipster
mkdir jhipster
cd jhipster
yo jhipster
gradle build
gradle

gradleを使って起動すれば、Spring Bootでサーバーごと起動しますが、 gulp serveを利用すれば、フロントエンド用のサーバーが起動するので、フロントエンド開発の場合はgulpを使うのがよいかも。

作成オプション

? (1/14) Which *type* of application would you like to create? 
❯ Monolithic application (recommended for simple projects) 
  Microservice application 
  Microservice gateway 
  [BETA] JHipster UAA server (for microservice OAuth2 authentication) 
? (2/14) What is the base name of your application? (jhipster) jhipster
? (3/14) Would you like to install other generators from the JHipster Market Place? (y/N) N
? (3/14) What is your default Java package name? (mrd.shinse.jhipster.sample) mrd.shinse.jhipster
? (4/14) Which *type* of authentication would you like to use? (Use arrow keys)
❯ HTTP Session Authentication (stateful, default Spring Security mechanism) 
  OAuth2 Authentication (stateless, with an OAuth2 server implementation) 
  JWT authentication (stateless, with a token) 
? (5/14) Which *type* of database would you like to use? (Use arrow keys)
❯ SQL (H2, MySQL, MariaDB, PostgreSQL, Oracle, MSSQL) 
  MongoDB 
  Cassandra 
? (6/14) Which *production* database would you like to use? (Use arrow keys)
❯ MySQL 
  MariaDB 
  PostgreSQL 
  Oracle - Warning! The Oracle JDBC driver (ojdbc) is not bundled because it is not Open Source. Please follow our documentation to install it ma
nually. 
  Microsoft SQL Server 
? (7/14) Which *development* database would you like to use? (Use arrow keys)
❯ H2 with disk-based persistence 
  H2 with in-memory persistence 
  MySQL 
? (8/14) Do you want to use Hibernate 2nd level cache? (Use arrow keys)
  No 
❯ Yes, with ehcache (local cache, for a single node) 
  Yes, with HazelCast (distributed cache, for multiple nodes) 
? (9/14) Would you like to use Maven or Gradle for building the backend? 
  Maven 
❯ Gradle 
? (10/14) Which other technologies would you like to use? 
❯◯ Social login (Google, Facebook, Twitter)
 ◯ Search engine using ElasticSearch
 ◯ Clustered HTTP sessions using Hazelcast
 ◉ WebSockets using Spring Websocket
 ◯ [BETA] Asynchronous messages using Apache Kafka
? (11/14) Would you like to use the LibSass stylesheet preprocessor for your CSS? (y/N) y
? (12/14) Would you like to enable internationalization support? (Y/n) Y
? (12/14) Would you like to enable internationalization support? Yes
? Please choose the native language of the application? (Use arrow keys)
❯ Japanese 
  Korean 
  Marathi 
  Polish 
  Portuguese (Brazilian) 
  Portuguese 
  Romanian 
(Move up and down to reveal more choices)
? Please choose additional languages to install 
 ◉ English
 ◯ Estonian
 ◯ French
❯◯ Galician
 ◯ German
 ◯ Greek
 ◯ Hindi
(Move up and down to reveal more choices)
? (13/14) Which testing frameworks would you like to use? (Press <space> to select, <a> to toggle all, <i> to inverse selection)
❯◉ Gatling
 ◯ Cucumber
 ◯ Protractor

次回は、Modelを追加してHerokuへデプロイする手順を試してみます。

mrdshinse.hatenablog.com

シリーズの一覧はこちら。 mrdshinse.hatenablog.com