Jhipster是基于nodejs+yeoman的java代码生成器。它集成了spring cloud的一些技术,采用问答式方法,构建一整套技术解决方案。
使用到的技术如下:
客户端:
服务器端:
一个完整的Spring application:
2.1在安装了node.js,yeoman之后,cd到生成目录的地址,用命令yo jhipster.
2.2 交互式问题
问题解释:
(1/16).which *type* of application would you like to create? (Use arrow keys) //
选择创建的应用类型,这里我选择第一个,第一个可以生成web应用
> Monolithic application (recommended for simple projects) //综合应用
Microservice application //微服务应用
Microservice gateway //微服务网关
(2/16). What is the base name of your application? //服务名,这里用jhipsterdemo(注意,不允许有空格)
(3/16) Would you like to install other generators from the JHipster Marketplace? No
(4/16).What is your default Java package name //默认包名,这里用的是com.wzc.jhipster
(5/16).Which *type* of authentication would you like to use? //选择认证方式,这里我选择第一种,无状态基于token验证
JWT authentication (stateless, with a token) //J(son)W(eb)T(oken)(无状态)
Authentication with JHipster UAA server (the server must be generated separately) //jhipsterUAA 认证服务,需要单独创建
(6/16).Do you want to use the JHipster Registry to configure, monitor and scale your application?//jhipster registry是一个基于spring cloud的配置中心。所有的微服务APP都需要注册到这里,集成了eureka
(7/16). Which *type* of database would you like to use? // 使用那种数据库
SQL (H2, MySQL, MariaDB, PostgreSQL, Oracle) //关系型数据库
MongoDB //NoSQL
Cassandra //NoSQL
(8/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 instal l it manually.
(9/16) Which *development* database would you like to use? //开发数据库
H2 with disk-based persistence //数据存储在磁盘的H2
H2 with in-memory persistence //内存H2(服务关闭数据丢失)
MySQL
(10/16) Do you want to use Hibernate 2nd level cache? //二级缓存
Yes, with ehcache (local cache, for a single node) //本地缓存方案 ehcache
Yes, with HazelCast (distributed cache, for multiple nodes) //集群缓存方案,多节点缓存,适合多微服务的分布式环境
(11/16) Would you like to use Maven or Gradle for building the backend? //选择后台构建系统
> Maven //更成熟,稳定,用户群体更大
Gradle //更灵活,易于扩展,支持maven一键转Gradle
(12/16) Which other technologies would you like to use? Social login (Google, Facebook, Twitter), WebSockets using Spring Websocket //可选技术
( )Social login (Google, Facebook, Twitter) //第三方社交登录,基于OAuth2.0
( )Search engine using ElasticSearch //集成搜索开源搜索引擎 ElasticSearch
( ) Clustered HTTP sessions using Hazelcast //使用Hazelcast管理http session集群
( ) WebSockets using Spring Websocket //使用Spring Websocket
( ) [BETA] Asynchronous messages using Apache Kafka //Apache Kafka 是一种高吞吐量的分布式发布订阅消息系统
(13/16) Which *Framework* would you like to use for the client?
(14/16) Would you like to use the LibSass stylesheet preprocessor for your CSS? No
(15/16) Would you like to enable internationalization support? //是否使用国际化
Please choose the native language of the application? English //选择本地化语言
Please choose additional languages to install Chinese (Simplified) //选择其余支持语言
(16/16) Besides JUnit and Karma, which testing frameworks would you like to use? //默认情况下 JHipster 提供 java 单元/集成测试(使用Spring JUnit支持)和 JavaScript 单元测试(使用Karma.js)
(*) Gatling //使用 Gatling 进行性能测试。
( ) Cucumber //使用 Cucumber 模拟用户行为
生成目录如下:
进入com.wzc.jhipster 右键JhipsterwebApp.java,run as java application。即可启动,界面如下: