0% found this document useful (0 votes)
2 views

Spring Assignments

The document outlines a series of spring assignments focused on creating and configuring beans using XML and annotations. Each assignment involves creating beans for entities such as Student, Address, Organization, and Employee, with tasks requiring both setter and constructor injection. The assignments also emphasize the use of different injection methods and configurations, including autowiring options and component scanning.

Uploaded by

Alex Abhisek
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Spring Assignments

The document outlines a series of spring assignments focused on creating and configuring beans using XML and annotations. Each assignment involves creating beans for entities such as Student, Address, Organization, and Employee, with tasks requiring both setter and constructor injection. The assignments also emphasize the use of different injection methods and configurations, including autowiring options and component scanning.

Uploaded by

Alex Abhisek
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Spring Assignments

Assignment 1:
NOTE : Configure Bean with XML file.
Create a Bean class with properties of

• Student ID
• Student Name
• Map of Subjects and marks.
TASK 1:

• Create one Bean Configuration with Setter Injection of above properties.


• Create another Bean Configuration with Constructor Injection of above properties.
• Get Both Bean configuration Objects and print Details

Assignment 2:
Create a Bean of Address with Properties of.
▪ City
▪ State
▪ Pincode
Create a Bean of Organization with Properties of.

• Organization name
• Address of Organization <Bean of Above Address>
Create a Bean of Employee with Properties of.
▪ Employee Name
▪ Employee Id
▪ Employee Salary
▪ Address of Employee <Bean of Above Address>
▪ Organization of Employee <Bean of Above Organization >

NOTE : Configure Beans with XML file.


TASK 1 : Now Create an application with Setter injection of all above dependencies
TASK 2 : Now Create another application with constructor injection of all above
dependencies

1 Spring Assignments Dilip Singh


Assignment 3:
Create a Bean of Address with Properties of.

• City
• State
• Pincode
Create a Bean of Organization with Properties of.

• Organization name
• Address of Organization <Bean of Above Address>
Create a Bean of Employee with Properties of.

• Employee Name
• Employee Id
• Employee Salary
▪ Address of Employee <Bean of Above Address>
▪ Organization of Employee <Bean of Above Organization >
NOTE : Configure Beans with XML file.
TASK 1:
Now Configure above three beans with default values as followed below.

• Setter injection of all above dependencies


• Please enable autowire=no
Now get Employee Object and from that get all injected dependency Objects and print all
details individually.
TASK 2:
Now Configure above three beans with default values as followed below.

• Setter injection of all above dependencies


• Please enable autowire=byName
Now get Employee Object and from that get all injected dependency Objects and print all
details individually.
TASK 3:
Now Configure above three beans with default values as followed below.

• Setter injection of all above dependencies


• Please enable autowire=byType
Now get Employee Object and from that get all injected dependency Objects and print all
details individually.

2 Spring Assignments Dilip Singh


TASK 4: Now Configure above three beans with default values as followed below.

• constructor injection of all above dependencies


• Please enable autowire=constructor
Now get Employee Object and from that get all injected dependency Objects and print all
details individually.

Assignment 4:
NOTE : Configure Bean with Annotations. NO XML configurations.
Create a Bean class with properties of

• Student ID
• Student Name
• Map of Subjects and marks.
TASK 1:

• Create one Bean Configuration with Configuration class and Bean method.
• Create another Bean Configuration with component and component scans.
• Get Both Bean configuration Objects and print Details
Assignment 5:
Create a Bean of Address with Properties of.
▪ City
▪ State
▪ Pincode
Create a Bean of Organization with Properties of.

• Organization name
• Address of Organization <Bean of Above Address>
Create a Bean of Employee with Properties of.
▪ Employee Name
▪ Employee Id
▪ Employee Salary
▪ Address of Employee <Bean of Above Address>
▪ Organization of Employee <Bean of Above Organization >
NOTE : Configure Bean with Annotations. NO XML configurations.
TASK 1 : Now Create an application with Setter injection of all above dependencies
TASK 2 : Now Create another application with constructor injection of all above
dependencies

3 Spring Assignments Dilip Singh


Assignment 6:
Create a Bean of Address with Properties of.
▪ City
▪ State
▪ Pincode
Create a Bean of Organization with Properties of.

• Organization name
• Address of Organization <Bean of Above Address>
Create a Bean of Employee with Properties of.
▪ Employee Name
▪ Employee Id
▪ Employee Salary
▪ Address of Employee <Bean of Above Address>
▪ Organization of Employee <Bean of Above Organization >

• NOTE : Configure Bean with Annotations. NO XML configurations.


• NOTE : Use only Configuration classes and Bean Methods
• NOTE : Don’t Use Component
TASK 1:
Now Configure above three beans with default values as followed below.

• Use Setter injection of all above dependencies


Now get Employee Object and from that get all injected dependency Objects and print all
details individually.
TASK 2:
Now Configure above three beans with default values as followed below.

• Field injection of all above dependencies


Now get Employee Object and from that get all injected dependency Objects and print all
details individually.
TASK 3:
Now Configure above three beans with default values as followed below.

• constructor injection of all above dependencies


Now get Employee Object and from that get all injected dependency Objects and print all
details individually.

4 Spring Assignments Dilip Singh


Assignment 7:
Create a Bean of Address with Properties of.
▪ City
▪ State
▪ Pincode
Create a Bean of Organization with Properties of.

• Organization name
• Address of Organization <Bean of Above Address>
Create a Bean of Employee with Properties of.
▪ Employee Name
▪ Employee Id
▪ Employee Salary
▪ Address of Employee <Bean of Above Address>
▪ Organization of Employee <Bean of Above Organization >

• NOTE : Configure Bean with Annotations. NO XML configurations.


• NOTE : Use only Component classes
• NOTE : Don’t Use Configuration Classes and Bean Methods
TASK 1:
Now Configure above three beans with default values as followed below.

• Use Setter injection of all above dependencies


Now get Employee Object and from that get all injected dependency Objects and print all
details individually.
TASK 2:
Now Configure above three beans with default values as followed below.

• Field injection of all above dependencies


Now get Employee Object and from that get all injected dependency Objects and print all
details individually.
TASK 3:
Now Configure above three beans with default values as followed below.

• constructor injection of all above dependencies


Now get Employee Object and from that get all injected dependency Objects and print all
details individually.

5 Spring Assignments Dilip Singh


Assignment 8:
Create a Bean of Address with Properties of.
▪ City
▪ State
▪ Pincode
Create a Bean of Organization with Properties of.

• Organization name
• Address of Organization <Bean of Above Address>
Create a Bean of Employee with Properties of.
▪ Employee Name
▪ Employee Id
▪ Employee Salary
▪ Address of Employee <Bean of Above Address>
▪ Organization of Employee <Bean of Above Organization >

• NOTE : Configure Bean with Annotations. NO XML configurations.


• NOTE : Use Component classes and minimum one Bean Method Configuration for every
Bean class i.e. More than one Bean Configurations of every Bean class, so more than one
Bean Objects of Bean class.
TASK 1:
Now Configure above three beans with default values as followed below.

• Use Setter injection of all above dependencies


Now get Employee Object and from that get all injected dependency Objects and print all
details individually.
TASK 2:
Now Configure above three beans with default values as followed below.

• Field injection of all above dependencies


Now get Employee Object and from that get all injected dependency Objects and print all
details individually.
TASK 3:
Now Configure above three beans with default values as followed below.

• constructor injection of all above dependencies


Now get Employee Object and from that get all injected dependency Objects and print all
details individually.

6 Spring Assignments Dilip Singh

You might also like