步骤1:在com.bstek.dorado.sample.standardlesson.service包中新建EmployeeService.java,代码如下:
package com.bstek.dorado.sample.standardlesson.service; import java.util.Collection; import javax.annotation.Resource; import org.springframework.stereotype.Component; import com.bstek.dorado.annotation.DataProvider; import com.bstek.dorado.sample.standardlesson.dao.SlEmployeeDao; import com.bstek.dorado.sample.standardlesson.entity.SlEmployee; @Component public class EmployeeService { @Resource private SlEmployeeDao slEmployeeDao; @DataProvider public Collection<SlEmployee> getAll(){ return slEmployeeDao.getAll(); } }
我们可以发现这个EmployeeService的getAll方法跟第四章中CompanyService的getCompany方法基本一样。