Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the Grails Console of Spring Boot?

I recently started spending more time on Spring Boot and have the started to feel the absence of a shell (similar to Grails console) like application that I can play with the repositories, services etc... Does something like this exist in spring boot?

like image 835
Alexander Suraphel Avatar asked Nov 09 '22 03:11

Alexander Suraphel


1 Answers

I recently launched the Spring Context from Groovy project, that gives you access to all beans object within the Remote Shell plugin using the repl groovy interactive console.

Looks like this:

$ 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("[email protected]")[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)
like image 126
Mariano Ruiz Avatar answered Nov 15 '22 07:11

Mariano Ruiz