执行报错No qualifying bean of type 'spittr.data.SpittleRepository' available:
检查发现SpittleRepository是接口,并没有实现,书中遗漏,应该补齐;
注意要添加@Repository注解
@Repository
public class SpittleRepositoryDAO implements SpittleRepository {
public SpittleRepositoryDAO() {
}
@Override
public List<Spittle> findSpittles(long max, int count) {
List<Spittle> spittles = new ArrayList<Spittle>();
for (int i = 0; i < count; i++) {
spittles.add(new Spittle("Spittle " + i, new Date()));
}
return spittles;
}
}
执行程序后查看
点击Spittles进入另一个页面