jhipster学习教程(三)创建第一个应用

准备工作完成了,那现在就开始创建第一个项目吧。

创建项目需要在命令行窗口进行,包括以后很多的操作都需要在命令行执行。

建议先装一个cmder,可以自己百度一下,后面有时间我整理个教程。进入项目根目录(以后所有操作没有特殊说明,都是在项目根目录操作)。

执行 yo jhipster (直接写jhipster 一样效果),会出来一堆说明,这个看看就好了,重点是选择项目类型。

jhipster有两种项目类型:独立应用 Monolithic application 和微服务模式的应用(Microservice gateway、JHipster UAA server、Microservice application)。根据自己的需要选择即可。

设置 Monolithic application项目

What is the base name of your application?  项目名称

What is your default Java package name? 包名

Do you want to use the JHipster Registry to configure, monitor and scale your application? 是否使用配置,监控扩展应用。如果选择yes,需要单独启动JHipster Registry应用。

设置认证方式

Which type of authentication would you like to use? 选择什么样的认证方式。这个问题依赖于之前的问题,如果选择JHipster Registry只能使用JWT方式,就不会出现这个问题了。

    JWT authentication: use a JSON Web Token (JWT), which is the default choice 。 JWT认证。

    OAuth 2.0 / OIDC Authentication: this uses an OpenID Connect server, like Keycloak or Okta。使用第三方认证。

    HTTP Session Authentication: the classical session-based authentication mechanism, like we are used to do in Java (this is how most people use Spring Security).  Session认证,使用的是Spring Security。

配置数据库类型

Which type of database would you like to use? 选择数据库类型

    An SQL database (H2, MySQL, MariaDB, PostgreSQL, MSSQL, Oracle), which you will access with Spring Data JPA  关系型数据库。

    MongoDB

    Cassandra

    Couchbase

如果选择关系型数据库需要继续设置生产环境和开发环境。

Which production database would you like to use? 选择生产环境数据库类型,会影响src/main/resources/config/application-prod.yml 文件里的配置。如果使用Oracle数据库,需要手工配置Oracle jdbc驱动

Which development database would you like to use? 选择生产环境数据库类型,会影响src/main/resources/config/application-dev.yml 文件里的配置。

配置缓存

Do you want to use the Spring cache abstraction? 选择是否使用缓存,以及缓存的类型。

     ehcache (local cache)本地缓存

     Hazelcast (distributed cache) 分布式缓存,不需要单独配置,应用会自己创建。如果要使用管理功能,需要单独安装管理工具,超过2个好像要收费

     Infinispan (another distributed cache) 另外一种分布式缓存。

    不使用缓存,同时也会关闭hibernate 2级缓存。

Do you want to use Hibernate 2nd level cache? 是否可开启hibernate 2级缓存,只有选择关系型数据库的时候才会出现这个问题。

配置使用maven还是Gradle

Would you like to use Maven or Gradle?

是否使用其他技术

Which other technologies would you like to use? 

Social login (Google, Facebook, Twitter) 社会化登陆,国内没卵用。

Search engine using ElasticSearch 是否使用ElasticSearch 。如果选择使用ElasticSearch,ElasticSearch只支持关系型数据库,同时在代码中需要解决一致性问题。jhipster在使用dev profile的时候会创建一个内部的ElasticSearch。在生产环境中需要自行安装配置ElasticSearch。

WebSockets using Spring Websocket 使用Websocket

API first development using swagger-codegen 使用API-First development

Asynchronous messages using Apache Kafka。使用Kafka,需要自行安装。

其他设置

Which Framework would you like to use for the client? 选择前端框架

Would you like to use the LibSass stylesheet preprocessor for your CSS? 添加libsass库的时候出现问题,建议不用。是否使用LibSass

Would you like to enable internationalization support? 国际化支持,根据需要选择就行了

Which testing frameworks would you like to use? 选择测试框架。

Would you like to install other generators from the JHipster Marketplace? 是否从市场安装其他生成器,很多可能有兼容问题,建议都不用。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 认识JHipster JHipster又称Java Hipster,是一个Java代码脚手架,hipster 的意...
    洋洋洒洒_6a20阅读 5,692评论 0 5
  • 原创性声明:本文完全为笔者原创,请尊重笔者劳动力。转载务必注明原文地址。 Jhipster初识# 本文基于自己根据...
    东方一号蓝阅读 16,641评论 8 35
  • Jhipster初识本文基于自己根据jhipster的初次接触,write down下一些笔记心得,以及一些操作步...
    简陌刀丶阿吉阅读 795评论 0 0
  • 小长假这三天,原想呆在家里,倒不是闭门思过,我久已学会原谅自己。如今外面的世道,实在太喧哗。但是路上的拥堵,已让我...
    海月先生阅读 809评论 4 5
  • 上小学的时候,不知道什么是梦想,只想着每天能偷着出去找伙伴耍高兴。 然后上了初中,开始的时候很想家,慢慢的不...
    子皿_bc77阅读 195评论 0 1