Bean Articles
3 articles about Bean. Explore Spring Boot implementation, design, and operations across related topics.
-
Understanding Spring Boot Bean Lifecycle - How to Use @PostConstruct, @PreDestroy, and InitializingBean
A visual walkthrough of the Spring Bean lifecycle from creation through initialization to destruction, explaining how to choose between four implementation patterns — @PostConstruct, @PreDestroy, InitializingBean, and DisposableBean — based on your use case.
-
Spring @Bean "Name" Guide - When to Set It? How Does It Work? What's the Priority?
A practical guide to the role of the 'name' attribute on Spring Boot's @Bean. Covers default naming conventions (method name = Bean name), how to assign explicit names/aliases, the priority of @Qualifier, @Primary, and parameter names, avoiding Bean name collisions, and tips for using constants, all with code examples.
-
What is @Configuration / @Bean in Spring Boot? A Clear Guide to How to Use Them
Have you ever come across @Configuration or @Bean while developing with Spring Boot? These are points that tend to cause confusion, such as 'What's the difference from @Component?' and 'Where is the correct place to use them?' This article explains the roles and usage of @Configuration/@Bean with concrete examples.