Is it wrong to pass reference interface to a bean from other bundle in blueprint ?

In my service bundle, there is just one Impl class , and in blueprint I am passing an interface (which is from another bundle ) as reference to this class.

import *com.fromsomeotherbundle*.dao.ReqDAO;

public class ReqServiceImpl implements ReqService {


    private ReqDAO reqDAO;

    public ReqServiceImpl() {
    //    Requestor r = new Requestor();
    }

    public ReqServiceImpl(ReqDAO reqDAO) {
        this.reqDAO = reqDAO;
        }

    public void addMember(Requestor requestor){
        String rkey = requestor.getId();
        String col1 = requestor.getCity();
        String col2 = requestor.getCountry();
        reqDAO.insertMulti(rkey, col1, col2);
// return Response.created(URI.create("/members/" + person.getId())).build();
    }
}

<bean id="reqServiceBean" class="com.tableters.alpha.invite.service.ReqServiceImpl">
<property name="ReqDAO" ref="reqDAOref"/>
</bean>
<reference id="reqDAOref" interface="com.tableters.alpha.invite.dao.ReqDAO"/>

* There is no dependency issue and all imports are fine.

Is this approach wrong ? Because when I start this bundle, its waiting on ReqDAO.
And what is the right approach ?

Appreciate any help.



best regards,
Ramesh

Reply via email to