Skip to main content

Posts

Showing posts from October, 2021

Java interview questions and answers for experienced (Core Java, Spring Boot, Hibernate, JPA)

 Here is a list of interview questions for the experienced guy who had more than 5 years of experience in Java, Spring Boot, Spring MVC, Hibernate, JPA. Please follow the questions bank for it.   @component vs @service vs @repository @Component: It is to mark a bean as a Spring-managed component. It is a generic stereotype for any spring-managed component. Spring will only pick up and register beans with @component and doesn't look for @service and @Repository @service:  The @Service annotation represents that our bean holds some business logic. @Repository: @Repository is a stereotype for the persistence layer and it is also a type of component. Its job is to catch all persistence-related exceptions and rethrow them as Spring DataAccessExceptions. Explain spring Bean Lifecycle A Spring bean needs to be instantiated when the container starts, based on JAVA or XML bean definition. ...