Micronaut CLI的配置文件和功能

微服务 CLI ?

Micronaut CLI是Micronaut提供的命令行工具(直接的描述)。

微服务命令行界面

Micronaut建议使用Micronaut CLI来创建新的Micronaut项目。

当创建新的Micronaut项目时,建议使用Micronaut CLI来创建。

特点是什么?

顺便说一下,在使用Micronaut的CLI时,有时需要按照以下方式指定–features。

如果想要将项目设为面向Groovy的情况下,可以这样做。

$ mn create-app hello-world-groovy --build maven --features=groovy

在这里可以指定的–features是什么呢?为了弄清楚,我来调查一下。

环境

这次的环境是这个。

$ mn -V
| Micronaut Version: 1.0.4
| JVM Version: 1.8.0_191

个人资料和特点

首先,确认的方法是什么?

特点

使用Micronaut CLI的profile-info命令时,需要指定一个Profile并执行。

个人资料中有两个部分:服务和功能。

在服务档案的情况下。

$ mn profile-info service
| Profile: service
--------------------
The service profile

| Provided Commands:
--------------------
  create-bean           Creates a singleton bean
  create-client         Creates a client interface
  create-controller     Creates a controller and associated test
  create-job            Creates a job with scheduled method
  create-websocket-client  Creates a Websocket client
  create-websocket-server  Creates a Websocket server
  help                  Prints help information for a specific command

| Provided Features:
--------------------
  annotation-api        Adds Java annotation API
  cassandra             Adds support for Cassandra in the application
  config-consul         Adds support for Distributed Configuration with Consul (https://www.consul.io)
  discovery-consul      Adds support for Service Discovery with Consul (https://www.consul.io)
  discovery-eureka      Adds support for Service Discovery with Eureka
  graal-native-image    Allows Building a Native Image
  groovy                Creates a Groovy application
  hibernate-gorm        Adds support for GORM persistence framework
  hibernate-jpa         Adds support for Hibernate/JPA
  http-client           Adds support for creating HTTP clients
  http-server           Adds support for running a Netty server
  java                  Creates a Java application
  jdbc-dbcp             Configures SQL DataSource instances using Commons DBCP
  jdbc-hikari           Configures SQL DataSource instances using Hikari Connection Pool
  jdbc-tomcat           Configures SQL DataSource instances using Tomcat Connection Pool
  jib                   Adds support for Jib builds
  jrebel                Adds support for class reloading with JRebel (requires separate JRebel installation)
  junit                 Adds support for the JUnit testing framework
  kafka                 Adds support for Kafka
  kafka-streams         Adds support for Kafka Streams
  kotlin                Creates a Kotlin application
  management            Adds support for management endpoints
  micrometer            Adds support for Micrometer metrics
  micrometer-atlas      Adds support for Micrometer metrics (w/ Atlas reporter)
  micrometer-graphite   Adds support for Micrometer metrics (w/ Graphite reporter)
  micrometer-prometheus  Adds support for Micrometer metrics (w/ Prometheus reporter)
  micrometer-statsd     Adds support for Micrometer metrics (w/ Statsd reporter)
  mongo-gorm            Configures GORM for MongoDB for Groovy applications
  mongo-reactive        Adds support for the Mongo Reactive Streams Driver
  neo4j-bolt            Adds support for the Neo4j Bolt Driver
  neo4j-gorm            Configures GORM for Neo4j for Groovy applications
  netflix-archaius      Adds support for Netflix Archaius in the application
  netflix-hystrix       Adds support for Netflix Hystrix in the application
  netflix-ribbon        Adds support for Netflix Ribbon in the application
  picocli               Adds support for command line parsing (http://picocli.info)
  postgres-reactive     Adds support for the Reactive Postgres driver in the application
  rabbitmq              Adds support for RabbitMQ in the application
  redis-lettuce         Configures the Lettuce driver for Redis
  security-jwt          Adds support for JWT (JSON Web Token) based Authentication
  security-session      Adds support for Session based Authentication
  spek                  Adds support for the Spek testing framework
  spock                 Adds support for the Spock testing framework
  springloaded          Adds support for class reloading with Spring-Loaded
  swagger-groovy        Configures Swagger (OpenAPI) Integration for Groovy
  swagger-java          Configures Swagger (OpenAPI) Integration for Java
  swagger-kotlin        Configures Swagger (OpenAPI) Integration for Kotlin
  tracing-jaeger        Adds support for distributed tracing with Jaeger (https://www.jaegertracing.io)
  tracing-zipkin        Adds support for distributed tracing with Zipkin (https://zipkin.io)

关于 Profile 的情况。

$ mn profile-info function
| Profile: function
--------------------
The function profile

| Provided Commands:
--------------------
  create-bean  Creates a singleton bean
  create-job   Creates a job with scheduled method
  help         Prints help information for a specific command

| Provided Features:
--------------------
  annotation-api        Adds Java annotation API
  cassandra             Adds support for Cassandra in the application
  config-consul         Adds support for Distributed Configuration with Consul (https://www.consul.io)
  discovery-consul      Adds support for Service Discovery with Consul (https://www.consul.io)
  discovery-eureka      Adds support for Service Discovery with Eureka
  graal-native-image    Allows Building a Native Image
  groovy                Creates a Groovy application
  hibernate-gorm        Adds support for GORM persistence framework
  hibernate-jpa         Adds support for Hibernate/JPA
  http-client           Adds support for creating HTTP clients
  http-server           Adds support for running a Netty server
  java                  Creates a Java application
  jdbc-dbcp             Configures SQL DataSource instances using Commons DBCP
  jdbc-hikari           Configures SQL DataSource instances using Hikari Connection Pool
  jdbc-tomcat           Configures SQL DataSource instances using Tomcat Connection Pool
  jib                   Adds support for Jib builds
  jrebel                Adds support for class reloading with JRebel (requires separate JRebel installation)
  junit                 Adds support for the JUnit testing framework
  kafka                 Adds support for Kafka
  kafka-streams         Adds support for Kafka Streams
  kotlin                Creates a Kotlin application
  management            Adds support for management endpoints
  micrometer            Adds support for Micrometer metrics
  micrometer-atlas      Adds support for Micrometer metrics (w/ Atlas reporter)
  micrometer-graphite   Adds support for Micrometer metrics (w/ Graphite reporter)
  micrometer-prometheus  Adds support for Micrometer metrics (w/ Prometheus reporter)
  micrometer-statsd     Adds support for Micrometer metrics (w/ Statsd reporter)
  mongo-gorm            Configures GORM for MongoDB for Groovy applications
  mongo-reactive        Adds support for the Mongo Reactive Streams Driver
  neo4j-bolt            Adds support for the Neo4j Bolt Driver
  neo4j-gorm            Configures GORM for Neo4j for Groovy applications
  netflix-archaius      Adds support for Netflix Archaius in the application
  netflix-hystrix       Adds support for Netflix Hystrix in the application
  netflix-ribbon        Adds support for Netflix Ribbon in the application
  openfaas              Adds support for OpenFaaS
  picocli               Adds support for command line parsing (http://picocli.info)
  postgres-reactive     Adds support for the Reactive Postgres driver in the application
  rabbitmq              Adds support for RabbitMQ in the application
  redis-lettuce         Configures the Lettuce driver for Redis
  security-jwt          Adds support for JWT (JSON Web Token) based Authentication
  security-session      Adds support for Session based Authentication
  spek                  Adds support for the Spek testing framework
  spock                 Adds support for the Spock testing framework
  springloaded          Adds support for class reloading with Spring-Loaded
  swagger-groovy        Configures Swagger (OpenAPI) Integration for Groovy
  swagger-java          Configures Swagger (OpenAPI) Integration for Java
  swagger-kotlin        Configures Swagger (OpenAPI) Integration for Kotlin
  tracing-jaeger        Adds support for distributed tracing with Jaeger (https://www.jaegertracing.io)
  tracing-zipkin        Adds support for distributed tracing with Zipkin (https://zipkin.io)

请用中文重新表达以下内容,只需要一种选项:

如下所示

| Provided Features:

在这个地方,可以看到一排排可供利用的特点。

看起来像是一样的吧?但仔细看,只有功能配置中混入了下一个。

  openfaas              Adds support for OpenFaaS

所以,”Profile” 是指项目模板,用于创建默认设置、构建依赖关系以及命令集合的结构和骨架。

个人资料

默认的个人资料是“服务”。

命令明显有所不同。

## service Profile
$ mn profile-info service
| Profile: service
--------------------
The service profile

| Provided Commands:
--------------------
  create-bean           Creates a singleton bean
  create-client         Creates a client interface
  create-controller     Creates a controller and associated test
  create-job            Creates a job with scheduled method
  create-websocket-client  Creates a Websocket client
  create-websocket-server  Creates a Websocket server
  help                  Prints help information for a specific command


## function Profile
$ mn profile-info function
| Profile: function
--------------------
The function profile

| Provided Commands:
--------------------
  create-bean  Creates a singleton bean
  create-job   Creates a job with scheduled method
  help         Prints help information for a specific command

这个简介有一个专门的组织在GitHub上。

微伍轻型配置版本

目前来看,由于现在有服务、功能和联邦,并且它们可能会增加。

通过这一步,你可以明白–features可以指定什么内容了吧。

另外,这里看起来也不错。

微纳米简介

实际上,据说可以指定的个人资料更多。

$ mn list-profiles
| Available Profiles
--------------------
  cli           The cli profile
  federation    The federation profile
  function-aws  The function profile for AWS Lambda
  kafka         The Kafka messaging profile
  profile       A profile for creating new Micronaut profiles
  service       The service profile

帮助和信息

如果要查看各个配置文件默认应用的功能等,请看看这个地方,好吗?

广告
将在 10 秒后关闭
bannerAds