बनाती है मैं जेपीए के साथ स्प्रिंग बूट v1.4.2.RELEASE एप्लिकेशन पर काम कर रहा हूं।एप्लिकेशन संदर्भ में से कुछ बीन्स की निर्भरता एक चक्र
मैं भंडार इंटरफेस और कार्यान्वयन
ARepository
@Repository
public interface ARepository extends CrudRepository<A, String>, ARepositoryCustom, JpaSpecificationExecutor<A> {
}
ARepositoryCustom
@Repository
public interface ARepositoryCustom {
Page<A> findA(findAForm form, Pageable pageable);
}
परिभाषित 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);
}
}
और एक सेवा AServiceImpl
@Service
public class AServiceImpl implements AService {
private ARepository aRepository;
public AServiceImpl(ARepository aRepository) {
super();
this.aRepository = aRepository;
}
...
}
मेरा आवेदन संदेश के साथ शुरू नहीं होगी:
*************************** APPLICATION FAILED TO START *************************** Description: The dependencies of some of the beans in the application context form a cycle: | aRepositoryImpl └─────┘
मैं सभी चरणों में http://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories.single-repository-behaviour
कृपया मदद वर्णित पीछा !
लॉरेंट
से 'ARepositoryCustom' –
एनोटेशन' दूर करने के लिए @ Repository' 'ARepositoryCustom' के रूप में' @ Repository' चिह्नित करने के लिए, क्योंकि आप इसे कार्यान्वयन के बजाय है स्प्रिंग डाटा – Aeteros
के साथ पैदा करने में प्रदान करने के लिए आप एक इंटरफेस 'करना चाहते हैं की जरूरत नहीं है की कोशिश करो एआरपोजिटरी 'जो कार्यान्वयन में अगले' इंटरपोजिटरी कस्टम 'का विस्तार करता है, आप इंटरफ़ेस' एआरपोजिटरी 'का उपयोग करते हैं। मुझे संदेह है कि स्पिंग डेटा जेपीए चीजों को समझने में सक्षम होंगे। यह भी है कि विधि आपकी सेवा में है, न कि आपके भंडार में। –