Spring Assignment Java
Spring Assignment Java
The three versions are Spring 2.5, Spring 3.0, and Spring 4.0.
Spring 2.5 was the first version to support annotations. It was released in the
year 2007. Spring 3.0 utilized upgrades in Java5 and furthermore offered help
to JEE6. It was released two years later in 2009. Spring 4.0 was the main
variant to offer comprehensive support to Java 8. It was released
in the year 2013.
キ You can use only what you really need because of the layered
architecture it uses.
キ You can use it with all other frameworks of Java with Spring
Frameworks. It does not impose any restrictions or limitations.
’
easy to use, and it is configurable. You can use other frameworks instead
of picking the Spring MVC Framework.
6.How many modules can you find in Spring Framework? Name them.
You can find twenty modules which are categorized into Core Container,
Web, Data Access/Integration, AOP (Aspect Oriented Programming),
Instrumentation, and Test.
Spring Bean
Spring Context
Web: This layer gives support to create a web application. It comprises of the
following modules:
Web
Web – MVC
Web – Socket
Web – Portlet
Transaction
Test: This layer gives support to testing with TestNG and Junit.
It is basically an XML file. You can find all the information about the classes in
this file. It further describes how these classes are configured and known to
each other. The XML configuration files are detailed, so it is necessary to keep
them clean. Otherwise, managing them becomes difficult if your project is big.
キ Bean class: You can find properties here along with the set and
get functions.
Spring Framework can be used as Enterprise Java Bean, which can wrap
existing POJOs.
The container is at the core of the Spring Framework. It is the container that
creates the objects, binds them, configures them, and be in charge of their
complete life cycle, which is from creation until the end.
Constructor Injection
Setter Injection
Interface Injection
Constructor Injection
setter injection
Beanfactory:-
Applicationcontext:-
It aids internationalization
Spring Beans are the objects that serve as the backbone of the user s
’
application. Beans are controlled by the Spring IoC container. By controlling it
means, they are instantiated, configured, wired, and managed by a Spring
IoC container. Beans are created using the configuration metadata that the
users provide to the container.
’
Java-configuration support are @Bean annotated methods, and
@Configuration annotated classes.
Singleton: This gives scope for the bean definition to a single instance
per Spring IoC container.
Prototype: This gives scope for a single bean definition to have any
number of object instances.
The below scopes are available only if the users employ a web-aware
ApplicationContext.
18. Explain the Bean life cycle in Spring Bean Factory Container
The Spring container first instantiates the bean from the bean s definition in
’
the XML file.
The factory calls setBeanName() by giving the bean s ID if the bean executes
’
the BeanNameAware interface.
19.What is auto wiring and name the different modes of auto wiring?
The Spring container has the capability to auto-wire relationships between the
connecting beans. The Spring can automatically resolve collaborators for your
bean by seeing the contents of the BeanFactory.
no: This is the pre-selected option, which means no auto wiring. You need to
use an explicit bean reference for wiring.
byName: It injects the object dependency based on the name of the bean. It
pairs and wires its properties with the beans explained by the exact names in
the XML file.
byType: As the name says, it injects the object dependency according to type.
It matches and wires a property if the type matches with one of the names
of the beans in an XML file.