- Mastering Spring Boot 2.0
- Dinesh Rajput
- 312字
- 2021-06-25 21:29:11
Spring Boot CLI
Spring Boot also provides a command-line tool that can be used to quickly write Spring applications. You can run Groovy scripts with Spring Boot CLI. Groovy code has almost zero boilerplate code compared with Java.
The Spring Boot documentation says:
"You don't need to use the CLI to work with Spring Boot but it's definitely the quickest way to get a Spring application off the ground."
Spring Boot's CLI gives you more free time from having to add starter dependencies and auto-configuration to let you focus only on writing your application-specific code. We have seen this in this chapter in the Groovy script HelloController. We can run this Groovy script with Spring Boot CLI.
Spring Boot CLI is a smart tool, because in the Groovy script, if you noticed, there are no import lines. But, Spring Boot CLI allows us to run it. What about dependent libraries, you ask? We don't have Maven or Gradle here. CLI is smart; it detects classes being used in your application and it also knows which Starter dependencies should be used for these classes; accordingly, Spring Boot CLI adds dependencies to the classpath to make it work.
As Spring Boot CLI adds dependencies, a series of auto-configuration kicks in and adds the required bean method configuration so that your application is able to respond to HTTP requests.
CLI is an optional feature of Spring Boot; it just allows you to write a complete application with your application code only as, it doesn't need to build a traditional project. CLI provides tremendous power and simplicity for Spring development. In Chapter 2, Customizing Auto-Configuration in Spring Boot Application, we will see how to set up Spring Boot CLI.
Let's move to another key component of Spring Boot's building blocks. This is Spring Boot Actuator, which gives us insight about running a Spring Boot application.
- 隨身查:從原始數(shù)據(jù)到完美Excel圖表
- Excel高效辦公:市場(chǎng)與銷售管理(修訂版)
- Word綜合應(yīng)用簡(jiǎn)明教程
- 零基礎(chǔ)學(xué)游戲UI設(shè)計(jì)
- Office2010從入門到精通(視頻講解+圖解+技巧)
- 游戲美術(shù)設(shè)計(jì)
- 金融精英Word實(shí)操手冊(cè):世界知名公司這樣制作研究報(bào)告
- PowerPoint 2016從入門到精通
- 學(xué)Office 2007辦公應(yīng)用
- 新編Word/Excel/PPT 2003從入門到精通
- Excel也可以很好玩(職場(chǎng)故事版)
- 會(huì)做圖表的人顯得特別牛
- Access數(shù)據(jù)庫(kù)程序設(shè)計(jì)
- 超簡(jiǎn)單:用Python讓Excel飛起來
- Office 2010辦公自動(dòng)化案例教程(微課版)