小编Lau*_*let的帖子

应用程序上下文中某些bean的依赖关系形成一个循环

我正在使用JPA开发Spring Boot v1.4.2.RELEASE应用程序.

我定义了存储库接口和实现

ARepository

@Repository
public interface ARepository extends CrudRepository<A, String>, ARepositoryCustom, JpaSpecificationExecutor<A> {
}
Run Code Online (Sandbox Code Playgroud)

ARepositoryCustom

@Repository
public interface ARepositoryCustom {
    Page<A> findA(findAForm form, Pageable pageable);
}
Run Code Online (Sandbox Code Playgroud)

ARepositoryImpl

@Repository
public class ARepositoryImpl implements ARepositoryCustom {
    @Autowired
    private ARepository aRepository;
    @Override
    public Page<A> findA(findAForm form, Pageable pageable) {
        return aRepository.findAll(
                where(ASpecs.codeLike(form.getCode()))
                .and(ASpecs.labelLike(form.getLabel()))
                .and(ASpecs.isActive()),
                pageable);
    }
}
Run Code Online (Sandbox Code Playgroud)

和服务 AServiceImpl

@Service
public class AServiceImpl implements AService {
    private ARepository aRepository;
    public AServiceImpl(ARepository aRepository) {
        super();
        this.aRepository = aRepository;
    }
    ...
}
Run Code Online (Sandbox Code Playgroud)

我的应用程序不会以消息开头: …

java spring spring-data-jpa spring-boot

10
推荐指数
3
解决办法
2万
查看次数

标签 统计

java ×1

spring ×1

spring-boot ×1

spring-data-jpa ×1