CORE JAVA INTERVIEW
CORE JAVA INTERVIEW
Provides support for creating loosely coupled, easily testable, and maintainable applications.
Inversion of Control (IoC) / Dependency Injection (DI): Spring allows developers to manage
application components using containers.
Spring MVC: A powerful framework for developing web applications using the Model-View-
Controller pattern.
Data Access/Integration: Simplifies JDBC and ORM (like Hibernate), and integrates with JPA for easy
data handling.
Spring Boot: Makes it easy to set up, configure, and run Spring-based applications with minimal
effort and predefined configurations.
Dependency Injection (DI): Objects are passed their dependencies (collaborators) by the
container rather than creating them internally.
Types of DI:
Constructor Injection
Setter Injection
2. Beans:
Beans are objects that are managed by the Spring IoC container.
Definition: Any object that is configured in the Spring context (via XML, annotations, or Java
configuration) is a Spring bean.
3. Spring Container:
Advice Types:
1. Components:
Controller: Acts as an intermediary between Model and View, processing user input.
2. DispatcherServlet:
Central to Spring MVC, it acts as the front controller and handles requests, delegating them to
appropriate handlers.
3. Annotations:
Spring supports a variety of view technologies like JSP, Thymeleaf, and FreeMarker.
ViewResolver: Resolves views and maps logical view names to actual views (like JSP or HTML).
Spring Boot
What is Spring Boot?
A tool built on top of Spring to simplify the setup and configuration of Spring-based applications.
Reduces boilerplate code and configurations with auto-configuration, embedded servers (like
Tomcat), and opinionated defaults.
3. Spring Boot Starter Projects: Predefined dependencies for different application types (e.g., web, JPA,
messaging).
4. Application Properties: A simplified way to configure the application with a single file
( application.properties or application.yml ).
2. Spring ORM:
Integrates Spring with ORM frameworks like Hibernate and JPA for easier data persistence
management.
Simplifies JPA/Hibernate integration using repositories, making data access easier with less
code.
Spring Security
A powerful and customizable authentication and access control framework for Java applications.
Handles common security concerns like login authentication, user roles, CSRF protection, etc.
What is Spring?
Walkthrough of a simple Spring MVC web application using controllers, views, and models.
Discuss how Spring Security can be used for authentication and authorization.