Upgrade to Pro — share decks privately, control downloads, hide ads and more …

タイトでキュートなHipがSterなBootとAngularでScaffold

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

 タイトでキュートなHipがSterなBootとAngularでScaffold

ほげ駆動の発表資料です。

Avatar for Shinichi Kozake

Shinichi Kozake

June 26, 2016
Tweet

More Decks by Shinichi Kozake

Other Decks in Technology

Transcript

  1. JHipster is JHipster is a Yeoman generator Spring Boot +

    AngularJS モダン Web アプリケーションを素早く作れることを⽬的 オープンソース YeomanはモダンWebアプリケーションを提供するScaffoldツール すべてGitHubで開ൃ https://github.com/jhipster/generator-jhipster
  2. ! $ npm install -g yo ! ! ! $

    npm install -g bower ! ! ! $ npm install -g gulp ! ! ! $ npm install -g generator-jhipster :FPNBOͷΠϯετʔϧ #PXFSͷΠϯετʔϧ (VMQͷΠϯετʔϧ +)JQ4UFSͷΠϯετʔϧ ローカルインストール
  3.  ██ ██ ██ ████████ ███████ ██████ ████████ ████████ ███████

    ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████████ ██ ███████ █████ ██ ██████ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██████ ██ ██ ████████ ██ ██████ ██ ████████ ██ ██ ! http://jhipster.github.io ! Welcome to the JHipster Generator v3.4.1 Application files will be generated in folder: /Users/s_kozake/IdeaProjects/hogeHipster ______________________________________________________________________________ ! JHipster update available: 3.4.2 (current: 3.4.1) Run npm install -g generator-jhipster to update. ______________________________________________________________________________ ! ? (1/16) Which *type* of application would you like to create? (Use arrow keys) ❯ Monolithic application (recommended for simple projects) Microservice application Microservice gateway [BETA] JHipster UAA server (for microservice OAuth2 authentication) *QYVQETGCVGCRR JHipsterではMonolithicなアプリケーションもしくは マイクロサービスアプリケーションを選୒できます。
  4.  ? (1/16) Which *type* of application would you like

    to create? (Use arrow keys) ❯ Monolithic application (recommended for simple projects) Microservice application Microservice gateway [BETA] JHipster UAA server (for microservice OAuth2 authentication) *QYVQETGCVGCRR 作成するアプリケションタイプを選୒します。 ここではMonolithicなアプリケーションを選୒します。
  5.  ? (2/16) What is the base name of your

    application? (hogeHipster) *QYVQETGCVGCRR アプリケーション名を⼊⼒します。 現在のディレクトリ名がデフォルトのアプリケーション名として表⽰されます。
  6.  ? (3/16) What is your default Java package name?

    (com.mycompany.myapp) *QYVQETGCVGCRR javaのパッケージ名を⼊⼒します。
  7.  ? (4/16) Which *type* of authentication would you like

    to use? HTTP Session Authentication (stateful, default Spring Security mechanism) ❯ OAuth2 Authentication (stateless, with an OAuth2 server implementation) JWT authentication (stateless, with a token) *QYVQETGCVGCRR 認ূ⽅式にHTTP Sessionを⽤いたैདྷのWebアプリケーション認ূ⽅式の他、 OAuth2やJWTを⽤いた認ূ⽅式が選୒できます。 これらを⽤いることで、ステートレスな認ূ⽅式が࣮現できます。
  8.  ? (5/16) Which *type* of database would you like

    to use? (Use arrow keys) ❯ SQL (H2, MySQL, MariaDB, PostgreSQL, Oracle) MongoDB *QYVQETGCVGCRR データベースを選୒します。 RDBMSの他、NoSQLであるMongoDBも選୒可能です。
  9.  ? (6/16) Which *production* database would you like to

    use? ❯ 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 manually. *QYVQETGCVGCRR プロダクトで使⽤するデータベースの種類を選୒します。 Oracleを選୒した場合、JDBCドライバはバンドルされていないҝ、 ⼿動で⽤意する必要があります。
  10.  ? (7/16) Which *development* database would you like to

    use? (Use arrow keys) ❯ H2 with disk-based persistence H2 with in-memory persistence MySQL ! *QYVQETGCVGCRR 開ൃで使⽤するデータベースの種類を選୒します。 H2かMYSQLが選୒でき、H2はデータをディスクに保存する場合と インメモリで動作する場合のどちらかを選୒できます。
  11.  ? (8/16) Do you want to use Hibernate 2nd

    level cache? ❯ No Yes, with ehcache (local cache, for a single node) Yes, with HazelCast (distributed cache, for multiple nodes) *QYVQETGCVGCRR Hibernate 2ndレベルキャッシュを⽤いるかどうかを選୒します。 ehcacheを⽤いたローカルキャッシュ⽅式もしくはHazelCastを⽤いた 複਺ノードでのキャッシュ⽅式も選୒可能です。
  12.  ? (9/16) Do you want to use a search

    engine in your application? No ❯ Yes, with ElasticSearch *QYVQETGCVGCRR 全⽂ݕ索エンジンであるElasticSearchを使⽤するかどうかを選୒します。 ElasticSearchを選୒すると、Spring Data ElasticSearchを⽤いた設定が ⾏われます。開ൃモードでは、組ࠐみのElasticSearchが⽤いられます。
  13.  ? (10/16) Do you want to use clustered HTTP

    sessions? (Use arrow keys) ❯ No Yes, with HazelCast *QYVQETGCVGCRR HTTP SessionをHazelCastを⽤いたクラスタ構成にするかどうかを選୒します。
  14.  ? (11/16) Do you want to use WebSockets? No

    ❯ Yes, with Spring Websocket *QYVQETGCVGCRR Spring Websocketを⽤いるかどうかを選୒します。
  15.  ? (12/16) Would you like to use Maven or

    Gradle for building the backend? Maven ❯ Gradle *QYVQETGCVGCRR ビルドツールにMavenかGradleを選୒します。
  16.  ? (13/16) Would you like to use the LibSass

    stylesheet preprocessor for your CSS? (y/N) *QYVQETGCVGCRR Sassをサポートするかどうかを選୒します。
  17.  ? (14/16) Would you like to enable internationalization support?

    (Y/n) *QYVQETGCVGCRR ࠃ際化をサポートするかを選୒します。
  18.  ? Please choose the native language of the application?

    Hindi Hungarian Italian ❯ Japanese Korean Marathi Polish (Move up and down to reveal more choices) *QYVQETGCVGCRR ࠃ際化を選୒した場合、ネイティブランゲージを選୒します。
  19.  ? Please choose additional languages to install ◯ Czech

    ◯ Danish ◯ Dutch ❯◉ English ◯ French ◯ Galician ◯ German (Move up and down to reveal more choices) *QYVQETGCVGCRR 他にサポートするネイティブランゲージを選୒します。
  20.  ? (15/16) Which testing frameworks would you like to

    use? (Press <space> to select) ❯◉ Gatling ◯ Cucumber ◯ Protractor *QYVQETGCVGCRR ⽤いたいテストフレームワークを選୒します。
  21.  Installing languages: ja, en create bower.json create package.json create

    README.md create .gitignore : create src/main/webapp/i18n/en/global.json create src/main/webapp/i18n/en/health.json create src/main/resources/i18n/messages_en.properties ! ! I'm all done. Running npm install & bower install for you to install the required dependencies. If this fails, try running the command yourself. ! ! npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated [email protected]: cross-spawn no longer requires a build toolchain, use it instead! npm WARN deprecated [email protected]: this package has been reintegrated into npm and is now out of date with respect to npm npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree. npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated [email protected]: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0. npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree. npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue fetchMetadata → 304 ▌ ╢████████████████████████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░╟ ! *QYVQETGCVGCRR 全ての選୒が終ると、インストールが始まります。
  22.  *QYVQETGCVGCRR ! $ git init ! $ git add

    . ! $ git commit -m "first install jhipster” ! $ git tag install インストールが終ったら、gitで管理しましょう。 適切な.gitignoreファイルが⽤意されているので便利です。
  23.  ? Do you want to add a field to

    your entity? (Y/n) ETGCVGGPVKV[ フィールドを追加するかどうかを聞かれますので、Yesを選୒します。
  24.  ? What is the name of your field? name

    ETGCVGGPVKV[ フィールド名を⼊⼒します。
  25.  ? What is the type of your field? (Use

    arrow keys) ❯ String Integer Long Float Double BigDecimal LocalDate (Move up and down to reveal more choices) ETGCVGGPVKV[ フィールドの型を選୒します。
  26.  ? Do you want to add validation rules to

    your field? (y/N) Y ETGCVGGPVKV[ フィールドのバリデーションルールを追加するかどうかを選୒します。
  27.  ? Which validation rules do you want to add?

    ◉ Required ❯◯ Minimum length ◉ Maximum length ◯ Regular expression pattern ETGCVGGPVKV[ 必須⼊⼒、最⼩/最⼤⾧や正規表現によるチェックを選୒できます。 ここでは、必須⼊⼒と最⼤⾧を選୒します。
  28.  ? What is the maximum length of your field?

    (20) 100 ETGCVGGPVKV[ 最⼤⾧の⾧さを⼊⼒します。
  29.  Generating field #2 ! ? Do you want to

    add a field to your entity? Yes ? What is the name of your field? birthDate ? What is the type of your field? LocalDate ? Do you want to add validation rules to your field? Yes ? Which validation rules do you want to add? Required ! ================= Author ================= Fields name (String) required maxlength='100' birthDate (LocalDate) required ! ETGCVGGPVKV[ 同༷に、birthDateフィールドを追加します。
  30.  ? Do you want to add a relationship to

    another entity? No ETGCVGGPVKV[ リレーションを追加するかどうかを選୒します。 ここではNoを選୒します。
  31.  ? Do you want to use a Data Transfer

    Object (DTO)? ❯ No, use the entity directly [BETA] Yes, generate a DTO with MapStruct ETGCVGGPVKV[ EntityのDTOを作成するかどうかを選୒できます。 ここでは、EntityをそのままDTOとして⽤いるのでNoを選୒します。
  32.  ? Do you want to use separate service class

    for your business logic? No, the REST controller should use the repository directly ❯ Yes, generate a separate service class Yes, generate a separate service interface and implementation ETGCVGGPVKV[ RESTコントローラからRepositoryを直接呼び出す⽅式かビジネスロジックを書く ҝのServiceクラスを作成するかどうかを選୒します。 ここでは、Serviceクラスの作成を選୒します。
  33.  ? Do you want pagination on your entity? No

    ❯ Yes, with a simple pager Yes, with pagination links Yes, with infinite scroll ETGCVGGPVKV[ ը⾯のページング⽅式を選୒します。 simple pager : Bootstrap pagerベースのページング pagination links: Bootstrap pagination コンポーネント infinite scroll : infinite scroll ディレクティブ
  34.  Everything is configured, generating the entity... ! create .jhipster/Author.json

    create src/main/java/team/hoge/hipster/domain/Author.java create src/main/java/team/hoge/hipster/repository/AuthorRepository.java create src/main/java/team/hoge/hipster/repository/search/AuthorSearchRepository.java create src/main/java/team/hoge/hipster/web/rest/AuthorResource.java create src/main/java/team/hoge/hipster/service/AuthorService.java create src/main/resources/config/liquibase/changelog/20160623225714_added_entity_Author.xml conflict src/main/resources/config/liquibase/master.xml ? Overwrite src/main/resources/config/liquibase/master.xml? overwrite force src/main/resources/config/liquibase/master.xml create src/main/webapp/app/entities/author/authors.html create src/main/webapp/app/entities/author/author-detail.html create src/main/webapp/app/entities/author/author-dialog.html create src/main/webapp/app/entities/author/author-delete-dialog.html conflict src/main/webapp/app/layouts/navbar/navbar.html ? Overwrite src/main/webapp/app/layouts/navbar/navbar.html? overwrite force src/main/webapp/app/layouts/navbar/navbar.html create src/main/webapp/app/entities/author/author.state.js create src/main/webapp/app/entities/author/author.controller.js create src/main/webapp/app/entities/author/author-dialog.controller.js create src/main/webapp/app/entities/author/author-delete-dialog.controller.js create src/main/webapp/app/entities/author/author-detail.controller.js create src/main/webapp/app/entities/author/author.service.js create src/main/webapp/app/entities/author/author.search.service.js create src/main/webapp/i18n/ja/author.json conflict src/main/webapp/i18n/ja/global.json ? Overwrite src/main/webapp/i18n/ja/global.json? overwrite force src/main/webapp/i18n/ja/global.json create src/main/webapp/i18n/en/author.json conflict src/main/webapp/i18n/en/global.json ? Overwrite src/main/webapp/i18n/en/global.json? overwrite force src/main/webapp/i18n/en/global.json create src/test/javascript/spec/app/entities/author/author-detail.controller.spec.js create src/test/java/team/hoge/hipster/web/rest/AuthorResourceIntTest.java create src/test/gatling/simulations/AuthorGatlingTest.scala ! Running gulp Inject to add javascript to index ETGCVGGPVKV[
  35.  ================= Book ================= Fields title (String) required maxlength='100' description

    (String) maxlength='200' publicationDate (LocalDate) required price (BigDecimal) required ! ! Generating relationships to other entities ! ? Do you want to add a relationship to another entity? (Y/n) y ETGCVGGPVKV[ Author Entityの時と同༷に、フィールドを追加します。 Author Entityとのリレーションを作成するので、 リレーションを追加するかどうかでYesを選୒します。
  36.  ? What is the name of the other entity?

    author ETGCVGGPVKV[ どのEntityとのリレーションを⽣成するかを聞かれるので、 authorを⼊⼒します。
  37.  ? What is the name of the relationship? (author)

    ETGCVGGPVKV[ リレーション名を聞かれるので、ここではデフォルトのauthorとします。
  38.  ? What is the type of the relationship? one-to-many

    ❯ many-to-one many-to-many one-to-one ETGCVGGPVKV[ リレーションのカーディナリティを選୒します。 Bookから⾒てAuthorは1つなので、「many-to-one」を選୒します。
  39.  ? When you display this relationship with AngularJS, which

    field from 'author' do you want to use? (id) name ETGCVGGPVKV[ BookのCRUDը⾯でAuthorを表⽰する時のフィールド名を⼊⼒します。 ここでは、nameを⼊⼒して名前を表⽰させることにします。
  40.  ? Do you want to add any validation rules

    to this relationship? (y/N) y ETGCVGGPVKV[ BookのCRUDը⾯でAuthorを表⽰する時のフィールド名を⼊⼒します。 ここでは、nameを⼊⼒して名前を表⽰することにします。
  41.  ? Which validation rules do you want to add?

    ❯◉ Required ETGCVGGPVKV[ リレーションにバリデーションルールを追加します。 ここでは、BookにରしてAuthorへのリレーションが必ず存在するようにするҝ、 Requiredを選୒します。
  42.  ================= Book ================= Fields title (String) required maxlength='100' description

    (String) maxlength='200' publicationDate (LocalDate) required price (BigDecimal) required ! Relationships author (Author) many-to-one required ETGCVGGPVKV[ 上記಺容でBook Entityを⽣成します。