This project demonstrates the core concepts of Dependency Injection (DI) using plain Java, Spring Core, and Spring Boot.
- Created
Printer
andUserService
classes. - Demonstrated constructor-based and setter-based injection.
- No Spring involved — just Java wiring.
- Added Spring Core dependency to a Maven project.
- Annotated components with
@Component
. - Used
AnnotationConfigApplicationContext
to retrieve beans.
- Bootstrapped project using Spring Initializr.
- Created a simple REST controller (
GreetingController
) with a "Hello, Spring Boot!" endpoint.
- Demonstrated how to exclude
DataSourceAutoConfiguration
. - Confirmed that no H2 DB starts when excluded.
- Used
application.properties
andapplication-dev.yml
. - Bound configuration using
@ConfigurationProperties("app")
. - Exposed
/title
endpoint to return configured title.
- Created interface
TimeService
with two implementations:SystemTimeService
(marked@Primary
)MockTimeService
(annotated with@Qualifier("mock")
)
- Injected into a
TimeController
.
Check docs/annotations.md
for:
- Sample output screenshots
- Console logs
- Controller outputs
- Configuration files
- Java 17+
- Spring Core
- Spring Boot
- Maven