- 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.
- Word排版技術(shù)大全(第2版)
- Office 2019高效辦公三合一從入門到精通(視頻自學(xué)版)
- 計算機(jī)聯(lián)鎖圖冊(第二版)
- Excel財務(wù)數(shù)據(jù)處理與分析實(shí)戰(zhàn)技巧精粹
- Word-Excel-PPT 2010辦公應(yīng)用從入門到精通(實(shí)戰(zhàn)強(qiáng)化版)
- Excel 2016表格、公式、函數(shù)與圖表應(yīng)用傻瓜書
- Excel的一千零一夜(一)
- Excel公式與函數(shù)應(yīng)用技巧
- Access 2010數(shù)據(jù)庫實(shí)用教程
- Excel效率手冊:早做完,不加班 ( 精華版·函數(shù)篇)(升級版)
- WPS Office辦公應(yīng)用從入門到精通
- Office 2013辦公應(yīng)用從入門到精通
- Excel市場分析應(yīng)用之道
- 精P之道:高效溝通PPT
- 移動游戲UI設(shè)計專業(yè)教程