Skip to main content

Week 3 Review — Spring Boot, Auto-Configuration, Actuator, and Startup

Goal

This review checks if I really understand Week 3.

Week 3 topics:

  1. Spring Boot mental model
  2. @SpringBootApplication
  3. @Configuration
  4. @EnableAutoConfiguration
  5. @ComponentScan
  6. Spring Boot starters
  7. Dependency management
  8. Auto-configuration
  9. Conditions
  10. Back-off
  11. Actuator
  12. Health endpoint
  13. Metrics endpoint
  14. Beans endpoint
  15. Conditions endpoint
  16. Application startup
  17. SpringApplication.run
  18. CommandLineRunner
  19. ApplicationRunner
  20. Application events
  21. Lazy initialization
  22. Startup debugging

1. Week 3 Big Picture

Week 1 answered:

How does Spring create and connect objects?

Week 2 answered:

How does Spring configure, activate, scope, initialize, and destroy beans?

Week 3 answers:

How does Spring Boot make Spring applications easier to configure, run, monitor, and debug?

Spring Boot adds:

starter dependencies
auto-configuration
embedded server
external configuration conventions
Actuator
startup runners
application events
production-ready monitoring
debugging tools

Memory sentence:

Spring Framework is the foundation.
Spring Boot makes Spring easier to configure, run, monitor, and deploy.

2. Core Memory Sentences

Memorize these:

Spring Boot is built on top of the Spring Framework.

Spring Framework provides IoC, DI, AOP, MVC, transactions, and bean lifecycle.

Spring Boot adds starters, auto-configuration, embedded server support, external configuration conventions, and Actuator.

@SpringBootApplication includes @Configuration, @EnableAutoConfiguration, and @ComponentScan.

@Configuration allows bean definitions.

@ComponentScan finds my application components.

@EnableAutoConfiguration enables Spring Boot auto-configuration.

Starters bring dependencies.

Auto-configuration configures beans based on dependencies and conditions.

Starter puts libraries on the classpath.

Auto-configuration sees those libraries and configures them.

Spring Boot dependency management provides compatible dependency versions.

Usually do not specify versions manually for Boot-managed dependencies.

Auto-configuration is conditional.

@ConditionalOnClass checks if a class exists on the classpath.

@ConditionalOnMissingBean creates a bean only if no suitable bean already exists.

Back-off means Boot does not create its default because I provided my own bean.

@ConditionalOnProperty creates configuration based on property values.

Component scanning finds my classes.

Auto-configuration applies Boot configuration classes.

Actuator provides production-ready monitoring and management endpoints.

The default Actuator base path is /actuator.

Only limited endpoints are exposed by default over HTTP.

Do not expose sensitive Actuator endpoints publicly.

Health shows app health.

Metrics show runtime measurements.

Beans shows registered Spring beans.

Conditions shows auto-configuration decisions.

Configprops shows configuration properties.

SpringApplication.run starts the Spring Boot application.

CommandLineRunner gets raw String args.

ApplicationRunner gets parsed ApplicationArguments.

Runners run after the application context starts.

ApplicationReadyEvent happens after runners.

Lazy initialization creates beans only when first needed.

Lazy initialization can improve startup but delay errors.

3. Concept Map

Spring Boot

├── Main Application
│ ├── @SpringBootApplication
│ ├── @Configuration
│ ├── @EnableAutoConfiguration
│ └── @ComponentScan

├── Starters
│ ├── spring-boot-starter-web
│ ├── spring-boot-starter-data-jpa
│ ├── spring-boot-starter-security
│ ├── spring-boot-starter-validation
│ ├── spring-boot-starter-actuator
│ └── spring-boot-starter-test

├── Dependency Management
│ ├── parent POM
│ ├── BOM
│ ├── managed versions
│ └── transitive dependencies

├── Auto-Configuration
│ ├── @ConditionalOnClass
│ ├── @ConditionalOnMissingBean
│ ├── @ConditionalOnBean
│ ├── @ConditionalOnProperty
│ ├── @ConditionalOnWebApplication
│ └── back-off

├── Actuator
│ ├── health
│ ├── info
│ ├── metrics
│ ├── beans
│ ├── conditions
│ ├── configprops
│ ├── env
│ └── loggers

└── Startup
├── SpringApplication.run
├── ApplicationContext refresh
├── CommandLineRunner
├── ApplicationRunner
├── ApplicationReadyEvent
├── ApplicationFailedEvent
└── lazy initialization

4. Most Important Exam Traps

Trap 1 — Spring vs Spring Boot

Wrong:

Spring Boot replaces Spring Framework.

Correct:

Spring Boot uses Spring Framework and adds convenience features.

Trap 2 — @SpringBootApplication

Wrong:

@SpringBootApplication is only one simple annotation with no special meaning.

Correct:

@SpringBootApplication combines @Configuration, @EnableAutoConfiguration, and @ComponentScan.

Trap 3 — Starter vs Auto-Configuration

Wrong:

A starter directly creates beans.

Correct:

A starter brings dependencies. Auto-configuration creates/configures beans based on those dependencies.

Trap 4 — Dependency Versions

Wrong:

I should manually specify versions for every Spring Boot dependency.

Correct:

Spring Boot dependency management provides compatible versions. Usually omit versions for Boot-managed dependencies.

Trap 5 — JPA Starter and Database Driver

Wrong:

spring-boot-starter-data-jpa includes the PostgreSQL driver automatically.

Correct:

The JPA starter gives JPA and Hibernate support, but I still need the database driver.

Example:

implementation("org.springframework.boot:spring-boot-starter-data-jpa")
runtimeOnly("org.postgresql:postgresql")

Trap 6 — Auto-Configuration Is Not Magic

Wrong:

Spring Boot randomly creates beans.

Correct:

Spring Boot uses conditions based on classpath, properties, existing beans, profiles, and application type.

Trap 7 — Back-Off

Wrong:

Boot always creates its default bean.

Correct:

Many auto-configurations back off when I define my own suitable bean.

Trap 8 — Component Scan vs Auto-Configuration

Wrong:

Component scanning and auto-configuration are the same.

Correct:

Component scanning finds my annotated classes.
Auto-configuration applies Boot configuration classes conditionally.

Trap 9 — Actuator Exposure

Wrong:

Adding Actuator exposes all endpoints publicly.

Correct:

Actuator endpoints must be exposed. Sensitive endpoints should be secured.

Trap 10 — YAML *

Wrong:

management:
endpoints:
web:
exposure:
include: *

Correct:

management:
endpoints:
web:
exposure:
include: "*"

Trap 11 — Runners

Wrong:

CommandLineRunner and ApplicationRunner run before Spring creates beans.

Correct:

Runners run after the ApplicationContext has been created and refreshed.

Trap 12 — CommandLineRunner vs ApplicationRunner

CommandLineRunner gets raw String args.
ApplicationRunner gets parsed ApplicationArguments.

Trap 13 — ApplicationStartedEvent vs ApplicationReadyEvent

ApplicationStartedEvent happens before runners.
ApplicationReadyEvent happens after runners.

Trap 14 — Lazy Initialization

Wrong:

Lazy initialization only improves things and has no downside.

Correct:

Lazy initialization can improve startup time but may delay errors until runtime.

Trap 15 — Debugging

Wrong:

I need to guess why auto-configuration happened.

Correct:

Use --debug, debug=true, /actuator/conditions, /actuator/beans, and /actuator/configprops.

Practice Questions and Answers

Question 1

What is Spring Boot?

Answer:

Spring Boot is a project built on top of the Spring Framework that makes Spring applications easier to configure, run, monitor, and deploy.


Question 2

What problem does Spring Boot solve?

Answer:

Spring Boot reduces manual configuration by providing starter dependencies, auto-configuration, embedded server support, external configuration conventions, and production-ready features like Actuator.


Question 3

What is the difference between Spring Framework and Spring Boot?

Answer:

Spring Framework provides core features like IoC, dependency injection, AOP, MVC, transactions, and data access. Spring Boot builds on Spring Framework and adds auto-configuration, starters, embedded server support, and production-ready features.


Question 4

What does @SpringBootApplication include?

Answer:

@SpringBootApplication includes:

@Configuration
@EnableAutoConfiguration
@ComponentScan

Question 5

What does @EnableAutoConfiguration do?

Answer:

@EnableAutoConfiguration enables Spring Boot’s auto-configuration mechanism, which configures beans based on classpath, properties, existing beans, conditions, profiles, and application type.


Question 6

What is a Spring Boot starter?

Answer:

A Spring Boot starter is a dependency bundle that brings together common libraries for a specific feature, such as web, JPA, security, validation, testing, or Actuator.


Question 7

What is the difference between a starter and auto-configuration?

Answer:

A starter brings dependencies onto the classpath. Auto-configuration configures beans based on those dependencies and other conditions.


Question 8

What is a transitive dependency?

Answer:

A transitive dependency is a dependency brought indirectly by another dependency.


Question 9

What is dependency management?

Answer:

Dependency management means using a known set of dependency versions so libraries work correctly together.


Question 10

Why should I usually omit versions for Boot-managed dependencies?

Answer:

Because Spring Boot dependency management provides compatible versions for many common libraries. Manually overriding versions can cause compatibility problems.


Question 11

What is auto-configuration?

Answer:

Auto-configuration is Spring Boot’s mechanism for automatically configuring beans based on classpath dependencies, properties, existing beans, conditions, profiles, and application type.


Question 12

What does @ConditionalOnClass do?

Answer:

@ConditionalOnClass applies configuration only if a specific class is present on the classpath.


Question 13

What does @ConditionalOnMissingBean do?

Answer:

@ConditionalOnMissingBean creates a bean only if no suitable bean already exists.


Question 14

What does auto-configuration back-off mean?

Answer:

Back-off means Spring Boot does not create its default bean because the user has already provided a suitable bean.


Question 15

What does @ConditionalOnProperty do?

Answer:

@ConditionalOnProperty applies configuration only if a specific property has a matching value.


Question 16

How can I debug auto-configuration?

Answer:

Use --debug, debug=true, startup logs, Actuator /actuator/conditions, /actuator/beans, /actuator/configprops, and dependency tree tools.


Question 17

What is Spring Boot Actuator?

Answer:

Spring Boot Actuator provides production-ready monitoring and management features through operational endpoints.


Question 18

What does /actuator/health show?

Answer:

/actuator/health shows application health status, such as UP, DOWN, OUT_OF_SERVICE, or UNKNOWN.


Question 19

What does /actuator/metrics show?

Answer:

/actuator/metrics shows runtime metrics such as JVM memory, HTTP request metrics, CPU usage, thread counts, and custom metrics.


Question 20

What does /actuator/conditions show?

Answer:

/actuator/conditions shows which auto-configurations matched or did not match and why.


Question 21

What does SpringApplication.run(...) do?

Answer:

SpringApplication.run(...) starts the Spring Boot application by creating and refreshing the ApplicationContext, loading configuration, applying auto-configuration, scanning components, creating beans, injecting dependencies, starting the web server if needed, running runners, and publishing application events.


Question 22

What is CommandLineRunner?

Answer:

CommandLineRunner is a callback interface that runs code after the application context has started. It receives raw command-line arguments as String... args.


Question 23

What is ApplicationRunner?

Answer:

ApplicationRunner is a callback interface that runs code after the application context has started. It receives parsed arguments as ApplicationArguments.


Question 24

What is ApplicationReadyEvent?

Answer:

ApplicationReadyEvent is published when the application is fully started and ready, after runners have executed.


Question 25

What is lazy initialization?

Answer:

Lazy initialization means beans are created only when first needed instead of eagerly during startup.

7. Mini Mock Exam — Week 3

Instructions

Try to answer without checking notes.

Recommended time:

40 minutes

Passing score:

80%

There are 40 questions.


Question 1

What is Spring Boot?

A. A replacement for Java B. A project built on Spring Framework that simplifies configuration, running, monitoring, and deployment C. A database framework only D. A frontend framework

My answer:


Question 2

Which annotation is the main entry annotation for a Spring Boot application?

A. @Service B. @SpringBootApplication C. @Entity D. @Repository

My answer:


Question 3

What does @SpringBootApplication include?

A. @Configuration, @EnableAutoConfiguration, @ComponentScan B. @Service, @Repository, @Entity C. @RestController, @Bean, @Table D. @Autowired, @Transactional, @Test

My answer:


Question 4

What does @ComponentScan do?

A. Finds application components in packages B. Creates database indexes C. Runs unit tests D. Builds Docker images

My answer:


Question 5

Where does Spring Boot scan by default?

A. From every package in the JVM B. From the package of the class annotated with @SpringBootApplication and its subpackages C. Only from java.lang D. Only from database packages

My answer:


Question 6

What does @EnableAutoConfiguration do?

A. Enables Spring Boot auto-configuration B. Enables only JPA repositories C. Disables dependency injection D. Creates frontend components

My answer:


Question 7

What is a Spring Boot starter?

A. A dependency bundle for a feature B. A controller method C. A SQL migration D. A Kubernetes pod

My answer:


Question 8

What does spring-boot-starter-web usually bring?

A. Spring MVC, embedded Tomcat, Jackson, web infrastructure B. Only PostgreSQL C. Only JUnit D. Only Flyway

My answer:


Question 9

What does spring-boot-starter-data-jpa provide?

A. React components B. JPA, Hibernate, Spring Data JPA support C. CSS tools D. Docker registry support

My answer:


Question 10

Do I still need a database driver with the JPA starter?

A. Yes B. No C. Only for frontend apps D. Only for tests

My answer:


Question 11

Which starter is commonly used for Bean Validation?

A. spring-boot-starter-validation B. spring-boot-starter-css C. spring-boot-starter-docker D. spring-boot-starter-clock

My answer:


Question 12

What can happen after adding spring-boot-starter-security?

A. Endpoints may become secured by default B. JPA is disabled C. The JVM shuts down immediately D. YAML files are deleted

My answer:


Question 13

What is dependency management?

A. Manually choosing random versions B. Using a compatible set of dependency versions C. Removing all transitive dependencies D. Writing SQL queries

My answer:


Question 14

Should I usually specify versions manually for Boot-managed dependencies?

A. Yes, always B. No, usually let Spring Boot manage them C. Only for controllers D. Only for test classes

My answer:


Question 15

What is a transitive dependency?

A. A dependency brought indirectly by another dependency B. A dependency used only for CSS C. A dependency that cannot be downloaded D. A database row

My answer:


Question 16

What is the Spring Boot BOM?

A. Bill of Materials that defines dependency versions B. A REST controller C. A database migration file D. A logging statement

My answer:


Question 17

What is auto-configuration?

A. Manually creating all beans B. Automatic conditional configuration based on classpath, properties, beans, and conditions C. A CSS feature D. A replacement for Java

My answer:


Question 18

What does @ConditionalOnClass check?

A. Whether a class is present on the classpath B. Whether a class is public only C. Whether a class has comments D. Whether a class is in Git

My answer:


Question 19

What does @ConditionalOnMissingBean do?

A. Creates a bean only if no suitable bean already exists B. Deletes missing beans C. Creates all beans twice D. Starts Tomcat manually

My answer:


Question 20

What does back-off mean?

A. Boot does not create its default bean because the user provided one B. Boot stops scanning all classes C. Boot disables Java D. Boot removes all profiles

My answer:


Question 21

What does @ConditionalOnProperty do?

A. Applies configuration based on property values B. Creates database columns C. Disables Actuator D. Runs tests only

My answer:


Question 22

What is the difference between component scanning and auto-configuration?

A. No difference B. Component scanning finds my classes; auto-configuration applies Boot configuration conditionally C. Component scanning only works in frontend apps D. Auto-configuration only works with XML

My answer:


Question 23

How can I see auto-configuration condition decisions?

A. /actuator/conditions B. /api/users C. /static/index.html D. /database/schema

My answer:


Question 24

What is Spring Boot Actuator?

A. Production-ready monitoring and management features B. A database migration tool C. A CSS compiler D. A frontend router

My answer:


Question 25

What dependency adds Actuator?

A. spring-boot-starter-actuator B. spring-boot-starter-html C. spring-boot-starter-git D. spring-boot-starter-terminal

My answer:


Question 26

What is the default Actuator base path?

A. /actuator B. /admin-only C. /api D. /spring

My answer:


Question 27

What does /actuator/health show?

A. Application health status B. All database rows C. Frontend CSS D. Git branches

My answer:


Question 28

What does /actuator/metrics show?

A. Runtime metrics B. Only user passwords C. Only source code D. Only database schemas

My answer:


Question 29

What does /actuator/beans show?

A. Registered Spring beans B. Browser cookies C. Maven repositories only D. CSS classes

My answer:


Question 30

What does /actuator/configprops show?

A. @ConfigurationProperties beans and bound values B. Only REST responses C. Only SQL indexes D. Only static files

My answer:


Question 31

How do I expose all Actuator endpoints in YAML?

A. include: "*" B. include: all-without-quotes-only C. exposeEverything: true D. actuator.all=true

My answer:


Question 32

Why should Actuator endpoints be secured?

A. They can expose sensitive internal information B. They are always public CSS files C. They delete the database automatically D. They disable the JVM

My answer:


Question 33

What does SpringApplication.run(...) do?

A. Starts the Spring Boot application and creates/refreshed the application context B. Only prints text C. Only compiles Java code D. Only starts React

My answer:


Question 34

What is CommandLineRunner?

A. Runs startup code with raw String... args B. Runs CSS compilation C. Runs only database backup D. Runs before Java starts

My answer:


Question 35

What is ApplicationRunner?

A. Runs startup code with parsed ApplicationArguments B. Runs only in browsers C. Runs SQL only D. Replaces Spring Security

My answer:


Question 36

When do runners run?

A. After the application context has started B. Before Java main method C. Before any bean exists D. Only after app shutdown

My answer:


Question 37

What happens if a runner throws an exception?

A. Startup usually fails B. Nothing ever happens C. Spring ignores it always D. It becomes an HTTP 404

My answer:


Question 38

When is ApplicationReadyEvent published?

A. After the app is fully started and runners have run B. Before environment is prepared C. Before main method D. Only during shutdown

My answer:


Question 39

What is lazy initialization?

A. Beans are created only when first needed B. Beans are never created C. Beans are created twice D. Beans are converted to JSON

My answer:


Question 40

What is a risk of lazy initialization?

A. Errors can be delayed until runtime B. Java cannot compile C. Actuator is deleted D. Starters stop working

My answer:


8. Mini Mock Exam Answers

Answer Key

1. B
2. B
3. A
4. A
5. B
6. A
7. A
8. A
9. B
10. A
11. A
12. A
13. B
14. B
15. A
16. A
17. B
18. A
19. A
20. A
21. A
22. B
23. A
24. A
25. A
26. A
27. A
28. A
29. A
30. A
31. A
32. A
33. A
34. A
35. A
36. A
37. A
38. A
39. A
40. A

9. Score

Total questions: 40
Correct answers:
Wrong answers:
Score:

Score calculation:

correct answers / 40 * 100

Example:

32 / 40 * 100 = 80%

10. Mistake Review Template

For every wrong answer, write this:

## Mistake

Question number:

My wrong answer:

Correct answer:

Why I was wrong:

Correct concept:

Memory sentence:

Example:

## Mistake

Question number: 20

My wrong answer: B

Correct answer: A

Why I was wrong:
I thought back-off means Boot disables auto-configuration completely.

Correct concept:
Back-off means Boot does not create its default bean because the user already provided a suitable bean.

Memory sentence:
Back-off means Boot steps aside for my bean.

11. Real Scenario Questions

These are more practical and interview-like.


Scenario 1 — Web Starter Missing

Code:

@RestController
@RequestMapping("/api/tasks")
public class TaskController {

@GetMapping
public List<String> tasks() {
return List.of("A", "B");
}
}

But the app does not expose HTTP endpoints.

Question:

What might be missing?

My answer:

Model Answer

The project may be missing:

implementation("org.springframework.boot:spring-boot-starter-web")

Without the web starter, Spring Boot may not configure Spring MVC or embedded Tomcat.


Scenario 2 — JPA Starter but No Database

Dependency:

implementation("org.springframework.boot:spring-boot-starter-data-jpa")

Error:

Failed to configure a DataSource

Question:

Why?

My answer:

Model Answer

The JPA starter brings JPA/database-related classes onto the classpath. Spring Boot’s DataSource auto-configuration matches and tries to configure a DataSource. If no database URL, driver, or embedded database is available, startup fails.

Fix options:

configure datasource
add database driver
use embedded database for tests
remove JPA starter if not needed
exclude DataSourceAutoConfiguration only if truly no database is needed

Scenario 3 — Security Starter Surprise

Dependency added:

implementation("org.springframework.boot:spring-boot-starter-security")

Suddenly endpoints require login.

Question:

Why?

My answer:

Model Answer

Spring Security is now on the classpath. Security auto-configuration matches and applies default security behavior. Define a SecurityFilterChain bean to customize authorization rules.


Scenario 4 — Custom ObjectMapper

Code:

@Configuration
public class JsonConfig {

@Bean
public ObjectMapper objectMapper() {
return new ObjectMapper().findAndRegisterModules();
}
}

Question:

What can happen to Boot’s default ObjectMapper?

My answer:

Model Answer

If Boot’s ObjectMapper auto-configuration uses @ConditionalOnMissingBean, it may back off because I already defined an ObjectMapper bean. My bean may replace Boot’s default.


Scenario 5 — Actuator Endpoint 404

You added:

implementation("org.springframework.boot:spring-boot-starter-actuator")

But this returns 404:

/actuator/conditions

Question:

Why?

My answer:

Model Answer

The endpoint is probably not exposed over HTTP. Add:

management:
endpoints:
web:
exposure:
include: conditions

or expose multiple endpoints:

management:
endpoints:
web:
exposure:
include: health,info,conditions

Scenario 6 — Dangerous Actuator Exposure

Config:

management:
endpoints:
web:
exposure:
include: "*"

Question:

What is dangerous?

My answer:

Model Answer

This exposes all Actuator endpoints over HTTP. Some endpoints can reveal sensitive internal information, such as environment properties, configuration properties, bean structure, mappings, thread dumps, or heap dumps. In production, expose only needed endpoints and secure them.


Scenario 7 — Runner Runs in Production

Code:

@Component
public class SeedRunner implements CommandLineRunner {

@Override
public void run(String... args) {
seedDemoData();
}
}

Question:

What is dangerous?

My answer:

Model Answer

The runner executes on every startup in every profile, including production. If it modifies data, it can be dangerous. Protect it with @Profile("dev") or @ConditionalOnProperty.


Scenario 8 — Lazy Initialization Hides Error

Config:

spring:
main:
lazy-initialization: true

The app starts successfully, but the first request fails because a bean has a missing dependency.

Question:

Why?

My answer:

Model Answer

Lazy initialization delayed bean creation until the bean was first needed. The missing dependency was not discovered at startup. Lazy initialization can make startup faster but delay errors until runtime.


12. Final Oral Exam — Week 3

Try to answer these out loud.

Question 1

Explain what Spring Boot is.


Question 2

Explain @SpringBootApplication.


Question 3

Explain the difference between Spring Framework and Spring Boot.


Question 4

Explain Spring Boot starters.


Question 5

Explain dependency management.


Question 6

Explain auto-configuration.


Question 7

Explain auto-configuration back-off.


Question 8

Explain how to debug auto-configuration.


Question 9

Explain Spring Boot Actuator.


Question 10

Explain SpringApplication.run.


Question 11

Explain CommandLineRunner vs ApplicationRunner.


Question 12

Explain lazy initialization.


13. Good Oral Answers

Oral Answer 1 — Spring Boot

Spring Boot is a project built on top of the Spring Framework. It makes Spring applications easier to configure, run, monitor, and deploy. It provides starter dependencies, auto-configuration, embedded server support, external configuration conventions, and production-ready features like Actuator. It does not replace Spring Framework; it uses it.


Oral Answer 2 — @SpringBootApplication

@SpringBootApplication is the main annotation for a Spring Boot application. It combines @Configuration, @EnableAutoConfiguration, and @ComponentScan. @Configuration allows bean definitions, @EnableAutoConfiguration enables Boot’s conditional auto-configuration, and @ComponentScan scans the current package and subpackages for components.


Oral Answer 3 — Spring Framework vs Spring Boot

Spring Framework provides the core features such as IoC, dependency injection, AOP, MVC, transactions, and data access. Spring Boot builds on top of Spring Framework and adds convenience features such as starters, auto-configuration, embedded server support, external configuration conventions, and Actuator.


Oral Answer 4 — Starters

Spring Boot starters are dependency bundles. They bring common libraries for a specific feature. For example, spring-boot-starter-web brings Spring MVC, embedded Tomcat, Jackson, and web infrastructure dependencies. Starters reduce dependency boilerplate and work together with auto-configuration.


Oral Answer 5 — Dependency Management

Spring Boot dependency management provides a compatible set of dependency versions. This means I usually do not specify versions manually for Boot-managed dependencies. Boot chooses versions that work well together, reducing runtime errors like NoSuchMethodError, ClassNotFoundException, or dependency conflicts.


Oral Answer 6 — Auto-Configuration

Auto-configuration is Spring Boot’s mechanism for automatically configuring beans based on classpath dependencies, application properties, existing beans, active profiles, application type, and conditions. It is not magic; it is conditional configuration. For example, if Spring MVC and Tomcat are on the classpath, Boot can configure a servlet web application.


Oral Answer 7 — Back-Off

Back-off means Spring Boot does not create its default bean because I already defined a suitable bean. This is commonly implemented with @ConditionalOnMissingBean. It allows Boot to provide defaults while still letting developers customize the application.


Oral Answer 8 — Debug Auto-Configuration

To debug auto-configuration, I check dependencies, active profiles, properties, and existing beans. I can run the app with --debug or debug=true to see condition evaluation logs. With Actuator, I can use /actuator/conditions to see auto-configuration matches, /actuator/beans to see registered beans, and /actuator/configprops to inspect bound configuration properties.


Oral Answer 9 — Actuator

Spring Boot Actuator provides production-ready monitoring and management features. It exposes operational endpoints such as /actuator/health, /actuator/info, /actuator/metrics, /actuator/beans, /actuator/conditions, and /actuator/configprops. These endpoints help monitor the application and debug runtime configuration. Sensitive endpoints should be secured and not exposed publicly.


Oral Answer 10 — SpringApplication.run

SpringApplication.run starts the Spring Boot application. It prepares the environment, loads configuration, creates and refreshes the ApplicationContext, applies auto-configuration, scans components, creates beans, injects dependencies, runs lifecycle callbacks, starts the embedded server if needed, runs startup runners, and publishes application events.


Oral Answer 11 — CommandLineRunner vs ApplicationRunner

Both run after the application context has started. CommandLineRunner receives raw command-line arguments as String... args. ApplicationRunner receives parsed arguments as an ApplicationArguments object. I use ApplicationRunner when I need structured option and non-option arguments.


Oral Answer 12 — Lazy Initialization

Lazy initialization means Spring creates beans only when they are first needed instead of eagerly during startup. It can improve startup time and reduce memory usage at startup, but it can also delay errors until runtime. For example, a missing dependency in a lazy bean may not appear until the first request uses that bean.


14. Week 3 Final Readiness Checklist

Before moving to Week 4, I should be able to check all of these:

[ ] I can explain what Spring Boot is.
[ ] I can compare Spring Framework and Spring Boot.
[ ] I know what @SpringBootApplication includes.
[ ] I can explain @Configuration.
[ ] I can explain @EnableAutoConfiguration.
[ ] I can explain @ComponentScan.
[ ] I know where Spring Boot scans by default.
[ ] I know why the main class should be in the root package.
[ ] I can explain starters.
[ ] I can explain dependency management.
[ ] I can explain transitive dependencies.
[ ] I know why versions are usually omitted.
[ ] I know what the Spring Boot BOM is.
[ ] I know what spring-boot-starter-web provides.
[ ] I know what spring-boot-starter-data-jpa provides.
[ ] I know that JPA still needs a database driver.
[ ] I know that validation often needs spring-boot-starter-validation.
[ ] I know that security starter can secure endpoints.
[ ] I can explain auto-configuration.
[ ] I can explain conditions.
[ ] I can explain @ConditionalOnClass.
[ ] I can explain @ConditionalOnMissingBean.
[ ] I can explain @ConditionalOnProperty.
[ ] I can explain back-off.
[ ] I can compare component scanning and auto-configuration.
[ ] I can debug auto-configuration with --debug and Actuator.
[ ] I can explain Actuator.
[ ] I know common Actuator endpoints.
[ ] I can explain health, info, metrics, beans, conditions, configprops.
[ ] I know Actuator endpoints should be secured.
[ ] I can explain SpringApplication.run.
[ ] I can explain startup flow.
[ ] I can explain CommandLineRunner.
[ ] I can explain ApplicationRunner.
[ ] I know runners run after context startup.
[ ] I can explain ApplicationReadyEvent.
[ ] I can explain lazy initialization.
[ ] I know lazy initialization can delay errors.

15. Weak Topics to Review Before Week 4

Write weak topics here:

## My Weak Topics

1.
2.
3.
4.
5.

For each weak topic:

## Weak Topic

Topic:

Why it is confusing:

Correct explanation:

Code example:

Memory sentence:

16. Week 3 Final Summary

Week 3 taught me how Spring Boot makes Spring easier.

The most important idea:

Spring Boot is Spring plus conventions, starters, auto-configuration, monitoring, and easier startup.

Spring Boot starts with:

@SpringBootApplication

which includes:

@Configuration
@EnableAutoConfiguration
@ComponentScan

Starters:

bring dependencies

Auto-configuration:

configures beans conditionally

Actuator:

shows operational information about a running app

Startup runners:

run code after the application context starts

Lazy initialization:

creates beans only when first needed

If I understand Week 3 well, I am ready for Week 4:

Spring MVC and REST APIs