What to do in PortfolioManagerFactory

I know we have to implement factory pattern in PortfolioManagerFactory.java file. But I cant understand how to do that. I took a look to the references but cant understand totally. As we have to use restTemplate but I cant understand how to use that. In PortfolioManagerImpl we have the following

public class PortfolioManagerImpl implements PortfolioManager {
private RestTemplate restTemplate;

protected PortfolioManagerImpl(RestTemplate restTemplate) {
    this.restTemplate = restTemplate;

@amanagar, @Pallav_crio, @Vinod_Crio_TA, @sridherj-criodo, @Sakshat-Crio.Do, @Saurav_Crio.Do, @sridherj-criodo

Is restTemplate is the attribute of the class it is visible all over the class. Means you can directly use this "restTemplate variable inside any function directly.

read this resource and understand what to do and how to do?


In simple words if i tell you then what does a factory do ? Create…that’s what we have to do create objects that are required.

1 Like

Hey @Soumyadip i think you should go through this query this will resolved half of your problem

@Soumyadip The issue seem to be resolved, as you have progressed onto next modules and hence I am closing this topic.

For further queries, you can create a new topic and continue there.