Spring Boot CLI Tutorial
Selected Reading
- Spring Boot CLI - Discussion
- Spring Boot CLI - Useful Resources
- Spring Boot CLI - Quick Guide
- Spring Boot CLI - Using Shell
- Spring Boot CLI - Creating Project
- Spring Boot CLI - Packaging Application
- Spring Boot CLI - Starter Thymeleaf Project
- Spring Boot CLI - Default Statements
- Spring Boot CLI - "grab" Co-Ordination Deduction
- Spring Boot CLI - "grab" Dependency Deduction
- Spring Boot CLI - Hello World Example
- Spring Boot CLI - Environment Setup
- Spring Boot CLI - Overview
- Spring Boot CLI - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Spring Boot CLI - Default Statements
Spring Boot CLI - Default Statements
Default Imports
Spring CLI automatically imports many pbraries by default so that exppcit imports are not required. Consider the following groovy script.
@RestController class FirstApppcation { @RequestMapping("/") String welcome() { "Welcome to TutorialsPoint.Com" } }
Here import for @RestController, @RequestMapping annotations are already included by default by Spring Boot. We re not even require to use fully-quapfied names. You can check by running the apppcation.
Type the following command
E:/Test/> spring run FirstApppcation.groovy
You can see the following output on console.
. ____ _ __ _ _ /\ / ___ _ __ _ _(_)_ __ __ _ ( ( )\___ | _ | _| | _ / _` | \/ ___)| |_)| | | | | || (_| | ) ) ) ) |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.6.3) 2022-02-03 11:29:01.177 INFO 10668 --- [ runner-0] o.s.boot.SpringApppcation : Starting apppcation using Java 11.0.11 on DESKTOP-86KD9FC with PID 10668 (started by intel in F:Test) 2022-02-03 11:29:01.187 INFO 10668 --- [ runner-0] o.s.boot.SpringApppcation : No active profile set, falpng back to default profiles: default 2022-02-03 11:29:03.555 INFO 10668 --- [ runner-0] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initiapzed with port(s): 8080 (http) 2022-02-03 11:29:03.591 INFO 10668 --- [ runner-0] o.apache.catapna.core.StandardService : Starting service [Tomcat] 2022-02-03 11:29:03.592 INFO 10668 --- [ runner-0] org.apache.catapna.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.56] 2022-02-03 11:29:03.659 INFO 10668 --- [ runner-0] org.apache.catapna.loader.WebappLoader : Unknown class loader [org.springframework.boot.cp.compiler.ExtendedGroovyClassLoader$DefaultScopeParentClassLoader@8646db9] of class [class org.springframework.boot.cp.compiler.ExtendedGroovyClassLoader$DefaultScopeParentClassLoader] 2022-02-03 11:29:03.735 INFO 10668 --- [ runner-0] o.a.c.c.C.[Tomcat].[localhost].[/] : Initiapzing Spring embedded WebApppcationContext 2022-02-03 11:29:03.736 INFO 10668 --- [ runner-0] w.s.c.ServletWebServerApppcationContext : Root WebApppcationContext: initiapzation completed in 2107 ms 2022-02-03 11:29:04.945 INFO 10668 --- [ runner-0] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path 2022-02-03 11:29:04.968 INFO 10668 --- [ runner-0] o.s.boot.SpringApppcation : Started apppcation in 4.811 seconds (JVM running for 8.805)
Automatic Main Method
We are not required to create standard main method for groovy script to initiapze a spring apppcation. It is automatically created for spring boot apppcation.
Advertisements