49.2.1 远程shell命令
你可以使用Groovy或Java编写其他的shell命令(具体参考CRaSH文档),Spring Boot默认会搜索以下路径的命令:
classpath*:/commands/**
classpath*:/crash/commands/**
注 设置shell.command-path-patterns
属性可以改变搜索路径。 注 如果使用可执行存档(archive),shell依赖的所有类都必须打包进一个内嵌的jar,而不是直接打包进可执行jar或war。
下面是一个从src/main/resources/commands/hello.groovy
加载的'hello'命令:
Spring Boot为InvocationContext
添加一些其他属性,你可以在命令中访问它们:
属性名称 | 描述 |
| Spring Boot的版本 |
| Spring核心框架的版本 |
| 获取Spring的 |
| 获取Spring的 |
Last updated