Challenge - 5 Problems
Spring Boot Starter Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediate2:00remaining
What happens when you run this Spring Boot main class?
Consider this Spring Boot application main class. What will be the output in the console when you run it?
Spring Boot
import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); System.out.println("Application started"); } }
Attempts:
2 left
💡 Hint
SpringApplication.run starts the Spring Boot context and logs startup info before the next line runs.
✗ Incorrect
SpringApplication.run launches the Spring Boot application and prints startup logs. The following System.out.println runs after startup, so both outputs appear.
📝 Syntax
intermediate2:00remaining
Identify the syntax error in this Spring Boot main class
Which option correctly fixes the syntax error in this Spring Boot main class?
Spring Boot
import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class args); } }
Attempts:
2 left
💡 Hint
Check the method call syntax and parameter separation.
✗ Incorrect
The method call requires a comma between parameters. Missing comma causes a syntax error.
❓ state_output
advanced2:00remaining
What is the value of 'running' after this Spring Boot application starts?
Given this code snippet, what will be the value of the 'running' variable after the application starts?
Spring Boot
import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.ConfigurableApplicationContext; @SpringBootApplication public class DemoApplication { public static void main(String[] args) { ConfigurableApplicationContext context = SpringApplication.run(DemoApplication.class, args); boolean running = context.isRunning(); System.out.println(running); } }
Attempts:
2 left
💡 Hint
Check what isRunning() returns after SpringApplication.run completes.
✗ Incorrect
After SpringApplication.run returns, the application context is running, so isRunning() returns true.
🔧 Debug
advanced2:00remaining
Why does this Spring Boot application fail to start?
This Spring Boot application fails with an error. What is the cause?
Spring Boot
import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class DemoApplication { public static void main(String[] args) { SpringApplication.run(); } }
Attempts:
2 left
💡 Hint
Check the method signature of SpringApplication.run.
✗ Incorrect
SpringApplication.run requires the main class and args parameters. Calling it without arguments causes a compile-time error.
🧠 Conceptual
expert3:00remaining
What is the role of the @SpringBootApplication annotation when running a Spring Boot app?
Which statement best describes what @SpringBootApplication does when you run a Spring Boot application?
Attempts:
2 left
💡 Hint
Think about what annotations @SpringBootApplication groups together.
✗ Incorrect
@SpringBootApplication is a convenience annotation that includes @Configuration, @EnableAutoConfiguration, and @ComponentScan, enabling automatic configuration and component scanning.