![](/img/trans.png)
[英]How to choose the package/folder when creating a controller with micronaut cli?
[英]Using Micronaut CLI to create app, controller
Micronaut CLI 在创建应用程序时非常有用,但是 CLI 中不存在创建控制器的命令。
Micronaut Version: 2.0.3
从 micronaut 文档中,我们有一个用于配置文件的命令https://docs.micronaut.io/2.0.0.M3/guide/index.html#cli
$ 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-test Creates a simple test for the project's testing framework
create-websocket-client Creates a Websocket client
create-websocket-server Creates a Websocket server
help Prints help information for a specific command
Provided Features:
------------------
...
当我运行命令mn profile-info service
我收到一个错误
我只有以下选项
我正在尝试从 cli 创建一个控制器
配置文件仅在 Micronaut 版本 1.x 中。 因此,像mn profile-info service
这样的配置文件相关命令在 Micronaut 2.x 版中不可用。
当你创建项目结束进入项目目录你可以使用这些额外的mn
命令:
feature-diff
- 生成原始项目与具有附加功能的原始项目的差异。create-job
- 使用预定方法创建作业create-client
- 创建客户端界面create-controller
- 创建一个控制器和相关的测试create-test
- 为项目的测试框架创建一个简单的测试create-bean
- 创建一个单例 beancreate-websocket-client
- 创建一个 Websocket 客户端create-websocket-server
- 创建一个 Websocket 服务器当您使用-h
选项调用它时,您还可以看到该命令的更多描述。 例如:
$ mn create-controller -h
Usage: mn create-controller [-fhvVx] CONTROLLER-NAME
Creates a controller and associated test
CONTROLLER-NAME The name of the controller to create
-f, --force Whether to overwrite existing files
-h, --help Show this help message and exit.
-v, --verbose Create verbose output.
-V, --version Print version information and exit.
-x, --stacktrace Show full stack trace when exceptions occur.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.