This project demonstrates a comprehensive hands-on mastery of the Spring Core module using real-world enterprise patterns.
It includes all major features of Spring Core, including Bean Scopes, Dependency Injection styles, Profiles, @Value
, SpEL, Component Scanning, and Lifecycle Callbacks.
com.chandrasekhar.springcore.capstone βββ config/ # Spring @Configuration class βββ controller/ # Application entry controller βββ env/ # Environment-specific @Profile-based beans βββ model/ # Domain model (Employee) βββ repository/ # Simulated repository layer βββ service/ # Business logic & notification service βββ util/ # Utility class for SpEL expressions βββ main/ # Main Application bootstrap class
- Java 21
- Spring Framework 6.2.x (Core, Context)
- Annotation-based configuration
- Maven
@Component
,@Service
,@Repository
,@Controller
stereotypes- Constructor, Setter, and Field-based Dependency Injection (
@Autowired
) - Java-based configuration using
@Configuration
and@Bean
- Prototype scope with manual injection via
ApplicationContext
- Environment-based profiles using
@Profile
- Property injection with
@Value
(fromapplication.properties
) - Spring Expression Language (SpEL)
- Lifecycle methods:
@PostConstruct
,@PreDestroy
- Manual lifecycle with
initMethod
,destroyMethod
- Clean separation of concerns using a layered architecture
- Set profile in main class:
context.getEnvironment().setActiveProfiles("dev"); // or "prod"
- Run the MainApp CapstoneApp.main()