美文网首页jhipster学习教程
jhipster学习教程(三)创建第一个应用

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

作者: erichui | 来源:发表于2018-02-02 15:10 被阅读0次

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

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

    建议先装一个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学习教程(三)创建第一个应用

        本文链接:https://www.haomeiwen.com/subject/izxezxtx.html