0% found this document useful (0 votes)
3 views1 page

Spring MVC Core Concepts Explained

The document explains key concepts of Spring MVC, including the role of DispatcherServlet as the front controller and the use of @Controller and @RequestMapping annotations. It also discusses bean injection methods, the differences between BeanFactory and ApplicationContext, and the default singleton scope of beans. Additionally, it lists various design patterns utilized within the Spring Framework.

Uploaded by

Paoli Bose
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Spring MVC Core Concepts Explained

The document explains key concepts of Spring MVC, including the role of DispatcherServlet as the front controller and the use of @Controller and @RequestMapping annotations. It also discusses bean injection methods, the differences between BeanFactory and ApplicationContext, and the default singleton scope of beans. Additionally, it lists various design patterns utilized within the Spring Framework.

Uploaded by

Paoli Bose
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

==>>What is the front controller class of Spring MVC?

The DispatcherServlet class works as the front controller in Spring MVC.

==>> What does @Controller annotation?

The @Controller annotation marks the class as controller class. It is applied on


the class.

==>>What does @RequestMapping annotation?

The @RequestMapping annotation maps the request with the method. It is applied on
the method.

==>>What does the ViewResolver class?

The View Resolver class resolves the view component to be invoked for the request.
It defines prefix and suffix properties to resolve the view component.

==>>Which Is the Best Way of Injecting Beans and Why?

The recommended approach is to use constructor arguments for mandatory dependencies


and setters for optional ones. This is because constructor injection
allows injecting values to immutable fields and makes testing easier.

==>>What Is the Difference Between BeanFactory and ApplicationContext?

BeanFactory is an interface representing a container that provides and manages bean


instances. The default implementation instantiates beans lazily when getBean() is
called.
In contrast, ApplicationContext is an interface representing a container holding
all information, metadata and beans in the application.
It also extends the BeanFactory interface, but the default implementation
instantiates beans eagerly when the application starts. However,
this behavior can be overridden for individual beans.

==>>What Is the Default Bean Scope in Spring Framework?


By default, a Spring Bean is initialized as a singleton.

==>> Name Some of the Design Patterns Used in the Spring Framework?
Singleton Pattern – singleton-scoped beans
Factory Pattern – Bean Factory classes
Prototype Pattern – prototype-scoped beans
Adapter Pattern – Spring Web and Spring MVC
Proxy Pattern – Spring Aspect-Oriented Programming support
Template Method Pattern – JdbcTemplate, HibernateTemplate, etc.
Front Controller – Spring MVC DispatcherServlet
Data Access Object – Spring DAO support
Model View Controller – Spring MVC

You might also like