Life Cycle of Spring Beans

Beans Creation Scan the application to create beans Create beans and their dependencies Invoke init() Call initialization method (if configured) Defined in three different ways for different configurations Invoked once then bean and its dependencies are created Use beans in Application Using the beans in the application according to the requirements Invoke destroy() Call destroy …

@RequestMapping, @GetMapping and @PostMapping in Spring

@RequestMapping Originally, Spring had only @RequestMapping annotation for mapping all the incoming HTTP request URLs to the corresponding controller methods. @RequestMapping(value = "/users", method = RequestMethod.GET) public Users getUsers() { } @RequestMapping(value = "/users", method = RequestMethod.POST) public User createUser(User user) { } @RequestMapping(value = "/users/{id}", method = RequestMethod.GET) public User getUser(@PathVariable("id") String id) { …

Spring – AOP

Aspect Oriented Programming with Spring Aspect-oriented Programming (AOP) complements Object-oriented Programming (OOP) by providing another way of thinking about program structure. The key unit of modularity in OOP is the class, whereas in AOP the unit of modularity is the aspect. Aspects enable the modularization of concerns (such as transaction management) that cut across multiple …

Spring – IoC

Introduction This Blog covers the Spring Framework implementation of the Inversion of Control (IoC) principle. From Spring official document, IoC is also known as dependency injection (DI). It is a process whereby objects define their dependencies (that is, the other objects they work with) only through constructor arguments, arguments to a factory method, or properties …