Answer to Question #280842 in Java | JSP | JSF for swati rathore

Question #280842
Create a Class User having following data members

Name (String)
Phone (String) T
Address (Address Class) -> Perform Dependency Injection
Team (Team Class) -> Perform Dependency Injection

Address Class have following data members
Address Line 1 (String)
Address Line 2 (String)
City (String)
State (String)
PINCODE (Integer)

Team Class have following data
Team Name (String) >> To be taken from properties file
Number of members (Integer) >> To be taken from properties file
Project (Project Class) -> Dependency Injections

Project Class have following Data
List of Sub Projects (Array List)

Implement the same using Spring 5 Annotation and XML Approaches

Create Beans for multiple employees and fetch the same in the Main Class.

Note: Create two different projects one for Annotations Based Approach and other for XML based approach.
1
Expert's answer
2021-12-17T18:18:13-0500
public class User {
    private String name;
    private String phone;
    private Address address;
    @Autowired
    private Team team;
}


public class Address {
    private String addressLine1;
    private String addressLine2;
    private String city;
    private String state;
    private int pincode;
}


public class Team {
    private String teamName;
    private int numberOfMembers;
    @Autowired
    private Project project;
}


import java.util.ArrayList;

public class Project {
    private ArrayList<Project> subProjects;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog