import com.google.inject.Binder;
public interface Module {
public void configure(Binder binder);
}
package CommonDtoServiceImpl;
import CommonDaoImpl.CommonDao;
import CommonDaoImpl.CommonDaoImpl;
import com.google.inject.Binder;
import com.google.inject.Module;
public class AddModule1 implements Module{
public void configure(Binder paramBinder) {
paramBinder.bind(CommonDao.class).to(CommonDaoImpl.class);
}
}
package CommonDtoServiceImpl;
import prototype.project.business6.Buiness6Service;
import prototype.project.business6.Buiness6ServiceImpl;
import com.google.inject.Binder;
import com.google.inject.Module;
public class AddModule implements Module{
public void configure(Binder binder) {
binder.bind(Buiness6Service.class).to(Buiness6ServiceImpl.class);
}
}
Controller
@Path("/hello")
public class ServiceMappingBusinessLogic1 {
@GET
public Response getMsg( String msg) {
Injector injector = Guice.createInjector(new AddModule());
Buiness6Service business6service = injector.getInstance(Buiness6Service.class);
String output =business6service.FindClient();
return Response.status(200).entity(output).build();
}
Controller
@Path("/hello")
public class ServiceMappingBusinessLogic1 {
@GET
public Response getMsg( String msg) {
Injector injector = Guice.createInjector(new AddModule());
Buiness6Service business6service = injector.getInstance(Buiness6Service.class);
String output =business6service.FindClient();
return Response.status(200).entity(output).build();
}
No comments:
Post a Comment