Suppose we have a controller ,which accepts the request and will response , but it depends on business layer.
@Controller
public class TodoController{
@Autowired
TodoBusinessService todoBusinessService;
}
TodoBusinessService depends to another dependency to fetch data from the database,
@Component
public class TodoBusinessService{
@Autowired
TodoDataService todoDataService;
}
now TodoDataService need to fire a query to fetch data from the database .So it depends on JdbcTemplate.
@Component
public class TodoDataService {
@Autowired
JdbcTemplate jdbcTemplate;
}
No comments:
Post a Comment