
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 17 Articles for Spring

22K+ Views
Spring supports multiple types annotations such as @Component, @Controller, @service @Repository and @Bean. All theses can be found under the org.springframework.stereotype package.When classes in our application are annotated with any of the above mentioned annotation then during project startup spring scan(using @componentScan) each class and inject the instance of the classes to the IOC container. Another thing the @ComponentScan would do is running the methods with @Bean on it and restore the return object to the Ioc Container as a bean.Sr. No.Key@Bean@Component1Auto detectionIt is used to explicitly declare a single bean, rather than letting Spring do it automatically. If any class ... Read More

2K+ Views
Factory and Dependency injection both are the design pattern which can be used to enhance loose coupling abilities between the software components. Factory design pattern is used to create objects. But, injection and life cycle management of the object should be handled by programmer within the application. There is no way to configure everything in a single place. Therefore, programmers need to call object creation logic wherever it needed which eventually hinder the loose coupling abilities.In DI design pattern, creation of object, injecting of the instance and life cycle management of the instance can be handled outside the code. In spring, ... Read More

4K+ Views
Inversion of control is a design principle which helps to invert the control of object creation.According to the paper written by Martin Fowler , inversion of control is the principle where the control flow of a program is inverted: instead of the programmer controlling the flow of a program, the external sources (framework, services, other components) take control of it. It's like we plug something into something else. He mentioned an example about EJB 2.0.Dependency Injection is a design pattern which implements IOC principle. DI provides objects that an object needs. Let’s say, class X is dependent on Y. So ... Read More

21K+ Views
Dependency Injection is a practice to pass dependent object to other objects. Spring has two types of Dependency Injection :Constructor based Injection -When container call the constructor of the class. It should be used for mandatory dependencies.Let’s say Class X is tightly dependent on Class Y then we should use constructor based injection. Setter based Injection - It can be used by calling setter methods on your beans. It should be used for optional dependencies.Both types of injection has their own pros and cons. Below is a list of some differences −Sr. No.KeyConstructor based InjectionSetter based Injection1CircularIt doesn’t allow to ... Read More

561 Views
Spring Boot Actuator is one of the greatest and most useful feature in Spring Boot framework. Actuator module in spring boot helps application developers to implement the production grade features like metrics, health check, security, etc. with minimal effort.This article will guide you through how to enable the spring boot actuator, configure endpoints and how to modify the default settings in the application.properties file. Note that spring boot actuator can work only for the spring boot application, this can not be integrated to the non-spring boot applications.List of Endpoints SupportedHere is the list of actuator endpoints that is supported at ... Read More

4K+ Views
Spring framework provides two IOC container for managing, configuring and manipulating beans. One is BeanFactory and the other is Application Context. The application context interface extends BeanFactory to enhance the functionality of BeanFactory. In new Spring versions, BeanFactory is replaced with ApplicationContext. But still, BeanFactory exists for backward compatibility. Spring version 2.0 and above, is used BeanPostProcessor extension point(Interface which provides some callback methods that we can implement to customize the instantiation logic, dependency-resolution logic and etc ). So, if you are using BeanFactory then some of the functionality such as AOP and transaction will not work without doing some extra configuration.Sr. No.KeyBeanfactoryApplication ... Read More

5K+ Views
Save and SaveAndFlush both can be used for saving entities. They both are both belong to the Spring data library. Save may or may not write your changes to the DB straight away. When we call saveAndFlush system is enforcing the synchronization of your model state with the DB. What is the save method? The save method is used to store an entity in the database. It adds the entity to the transactional buffer, and when the transaction is committed, the data is saved. It then returns the stored entity. Example The following is an example of the save method ... Read More