Spring Boot 的 Grails 控制台是什么?

Ale*_*hel 5 grails spring spring-boot

我最近开始在 Spring Boot 上花费更多的时间,并且开始感觉没有像应用程序这样的 shell(类似于 Grails 控制台),我可以使用存储库、服务等......在 spring boot 中是否存在这样的东西?

Mar*_*uiz 1

我最近从 Groovy 项目启动了 Spring Context ,它使您可以使用Remote Shell插件访问所有 beans 对象repl groovy插件中的所有 beans 对象。

看起来像这样:

$ ssh -p 2000 user@localhost
user@localhost's password:
  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::  (v1.4.6.RELEASE) on myhost
> repl groovy
Using repl groovy
> ctx.App.myUserService.findUserByEmail("mrsarm@gmail.com")[0].id
100123
> ctx.App.myUserService.getById(100123).name
Mariano Ruiz
> ctx.App.contactDao.logger.effectiveLevel
INFO
> ctx.App.contactDao.logger.setLevel(ch.qos.logback.classic.Level.DEBUG)
Run Code Online (Sandbox Code Playgroud)