我收到错误消息“说明:
应用程序上下文中某些bean的依赖关系形成一个循环:
┌─────┐ | jpaProductsDaoImpl在文件[C:\ W ##### \ Repository_IntelliJ \ A #### \ out \ production \ classes \ pl \ edu \ agh \ bazydanych2017 \ dao \ jpa \ JpaProductsDaoImpl.class]中定义 └─────┘
JpaProductsDaoImpl类
@Repository
public class JpaProductsDaoImpl {
private final JpaProductsDao jpaProductsDao;
@Autowired
public JpaProductsDaoImpl(JpaProductsDao jpaProductsDao) {
this.jpaProductsDao = jpaProductsDao;
}
@PostConstruct
public void jpaRunAtStart(){
Products findByName = jpaProductsDao.findByProductname("Chai");
System.out.println("JPA " + findByName);
List<Products> sortByProductName = jpaProductsDao.findAll(new Sort(Sort.Direction.ASC, "productname"));
for (Products products : sortByProductName) {
System.out.println("JPA Sort " + products);
}
}