Bird
0
0

Which of the following is the correct way to start a Spring Boot application?

easy📝 Syntax Q12 of 15
Spring Boot - Fundamentals
Which of the following is the correct way to start a Spring Boot application?
Apublic void start() { Spring.run(App.class); }
Bpublic static void main(String[] args) { SpringApplication.run(App.class, args); }
Cpublic static void main(String[] args) { Application.run(App.class); }
Dpublic static void main(String[] args) { BootApplication.run(App.class); }
Step-by-Step Solution
Solution:
  1. Step 1: Recall Spring Boot startup method

    Spring Boot apps start with SpringApplication.run() inside main().
  2. Step 2: Check options for correct syntax

    Only public static void main(String[] args) { SpringApplication.run(App.class, args); } uses correct method and signature.
  3. Final Answer:

    public static void main(String[] args) { SpringApplication.run(App.class, args); } -> Option B
  4. Quick Check:

    Spring Boot starts with SpringApplication.run() = A [OK]
Quick Trick: Spring Boot apps start with SpringApplication.run() [OK]
Common Mistakes:
  • Using incorrect method names like Application.run()
  • Missing static main method signature
  • Confusing Spring Boot with other frameworks

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes