0
0
Spring Bootframework~5 mins

Running a Spring Boot application in Spring Boot - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the main class annotation to start a Spring Boot application?
The main class should be annotated with <code>@SpringBootApplication</code>. This annotation enables auto-configuration, component scanning, and configuration support.
Click to reveal answer
beginner
How do you run a Spring Boot application from the command line using Maven?
Use the command mvn spring-boot:run in the project directory. This compiles and runs the application without needing to build a jar first.
Click to reveal answer
beginner
What method is used to launch the Spring Boot application in the main class?
The method SpringApplication.run(MainClass.class, args) is called inside the main method to start the application.
Click to reveal answer
beginner
What file is commonly used to configure Spring Boot application properties?
The application.properties or application.yml file in the src/main/resources folder is used to configure settings like server port, database, and logging.
Click to reveal answer
intermediate
How can you package a Spring Boot application to run it as a standalone jar?
Use mvn clean package to build a jar file in the target folder. Run it with java -jar target/appname.jar to start the app.
Click to reveal answer
Which annotation marks the main class to enable Spring Boot features?
A@SpringBootApplication
B@EnableAutoConfiguration
C@ComponentScan
D@Configuration
What command runs a Spring Boot app using Maven without building a jar?
Amvn package
Bmvn clean install
Cjava -jar app.jar
Dmvn spring-boot:run
Where do you place application configuration files in a Spring Boot project?
Asrc/main/java
Bsrc/test/resources
Csrc/main/resources
Dsrc/config
Which method starts the Spring Boot application inside the main class?
AApplication.start()
BSpringApplication.run()
CBoot.run()
DMain.launch()
How do you run a packaged Spring Boot jar file?
Ajava -jar target/appname.jar
Bmvn spring-boot:run
Cjava appname.jar
Dmvn run
Explain the steps to run a Spring Boot application from source code using Maven.
Think about the main class setup and the Maven command to start the app.
You got /3 concepts.
    Describe how to package and run a Spring Boot application as a standalone jar.
    Focus on building and running the jar file.
    You got /3 concepts.