More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know.
Ans. Instantiation by using:
InitializingBean callback interface.
Custom init() method from the bean configuration file.
Aware interfaces for distinct actions.
PostConstruct and PreDestroy annotations.
Destruction.
DisposableBean callback interface
Help us improve. Please let us know the company, where you were asked this question :
Ans. Spring is a Framework where we have to Build the Configurations Manually but Springboot have default configurations that allow faster bootstrapping. Spring Framework requires a number of dependencies to create a web app. Spring Boot, on the other hand, can get an application working with just one dependency.
Help us improve. Please let us know the company, where you were asked this question :
With Spring, we use the @ComponentScan annotation along with the @Configuration annotation to specify the packages that we want to be scanned. @ComponentScan without arguments tells Spring to scan the current package and all of its sub-packages.
Help us improve. Please let us know the company, where you were asked this question :
Ans. These annotations are used to create Spring beans automatically in the application context. The main stereotype annotation is @Component . @Controller: Which is used to create Spring beans at the controller layer. The stereotype annotations in spring are @Component, @Service, @Repository and @Controller
Help us improve. Please let us know the company, where you were asked this question :
Ans. The architecture of a Spring Boot project can be divided into three layers:
Presentation Layer:
This layer is responsible for handling user requests and generating responses. It includes the user interface, which can be a web UI or a RESTful API. Spring Boot provides various options to develop web applications, such as Spring MVC, Thymeleaf, and others.
Service Layer:
This layer contains the business logic of the application. It is responsible for processing the user requests and generating responses. The Service Layer interacts with the Data Access Layer to fetch and store data.
Data Access Layer:
This layer is responsible for interacting with the database or any other external data source. It includes the database model, repositories, and data access objects. Spring Boot provides support for various data access technologies, such as JPA, JDBC, and Spring Data JPA.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Setter Injection in Spring is a type of dependency injection in which the framework injects the dependent objects into the client using a setter method.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Yes, But with interceptor it will remove the body from the request and then we will have to explicitly add the attributes to the session to forward it to the handler.
Help us improve. Please let us know the company, where you were asked this question :
Ans. No, if required we should only have final variables. Bean scoped singleton means that only one instance of the bean will be created and will be shared among different requests and hence instance variables will get shared too.
Help us improve. Please let us know the company, where you were asked this question :