{"record":{"id":"0b70c1767f886233","repo":"quarkusio/quarkus","slug":"class-classinfo-name-which-is-annotated-with","errorCode":null,"errorMessage":"Class ${classInfo.name()} which is annotated with @RepositoryDefinition cannot also extend ${supportedRepository}","messagePattern":"Class (.+?) which is annotated with @RepositoryDefinition cannot also extend (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/SpringDataJPAProcessor.java","lineNumber":174,"sourceCode":"        noRepositoryBeanRepos.removeIf(DotNames.SUPPORTED_REPOSITORIES::contains);\n        Set<ClassInfo> interfacesExtending = getAllInterfacesExtending(noRepositoryBeanRepos, indexView);\n        interfacesExtendingRepository.addAll(interfacesExtending);\n    }\n\n    // classes annotated with @RepositoryDefinition behave exactly as if they extended Repository\n    private void addRepositoryDefinitionInstances(IndexView indexView, Set<ClassInfo> interfacesExtendingRepository) {\n        Collection<AnnotationInstance> repositoryDefinitions = indexView\n                .getAnnotations(DotNames.SPRING_DATA_REPOSITORY_DEFINITION);\n        for (AnnotationInstance repositoryDefinition : repositoryDefinitions) {\n            AnnotationTarget target = repositoryDefinition.target();\n            if (target.kind() != AnnotationTarget.Kind.CLASS) {\n                continue;\n            }\n            ClassInfo classInfo = target.asClass();\n            Set<DotName> supportedRepositories = DotNames.SUPPORTED_REPOSITORIES;\n            for (DotName supportedRepository : supportedRepositories) {\n                if (classInfo.interfaceNames().contains(supportedRepository)) {\n                    throw new IllegalArgumentException(\"Class \" + classInfo.name()\n                            + \" which is annotated with @RepositoryDefinition cannot also extend \" + supportedRepository);\n                }\n            }\n            interfacesExtendingRepository.add(classInfo);\n        }\n    }\n\n    private void detectAndLogSpecificSpringPropertiesIfExist() {\n        Config config = ConfigProvider.getConfig();\n\n        Iterable<String> iterablePropertyNames = config.getPropertyNames();\n        List<String> propertyNames = new ArrayList<String>();\n        iterablePropertyNames.forEach(propertyNames::add);\n        List<String> springProperties = propertyNames.stream().filter(s -> pattern.matcher(s).matches()).toList();\n        String notSupportedProperties = \"\";\n\n        if (!springProperties.isEmpty()) {\n            for (String sp : springProperties) {","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/SpringDataJPAProcessor.java#L156-L192","documentation":"A class annotated with @RepositoryDefinition (Spring Data's way to define a repository interface without extending CrudRepository) was found to also extend one of Quarkus's supported repository interfaces (CrudRepository, JpaRepository, etc.). This combination is ambiguous and rejected with IllegalArgumentException during augmentation.","triggerScenarios":"An interface annotated @RepositoryDefinition whose 'extends' clause lists a supported Spring Data repository interface (e.g. extends CrudRepository<T, ID>) — detected in addRepositoryDefinitionInstances while scanning indexed classes.","commonSituations":"Merging a custom repository definition with an inherited base interface during a refactor; copy-pasting @RepositoryDefinition onto a repository that already extends JpaRepository; SDK-generated repositories adding the annotation.","solutions":["Remove @RepositoryDefinition and rely on the extended supported repository interface","Or remove the 'extends <supportedRepository>' clause and keep only @RepositoryDefinition with its domain type and ID type parameters","Verify the class is a pure @RepositoryDefinition interface: it should not extend CrudRepository/PagingAndSortingRepository/JpaRepository/ReactiveCrudRepository etc."],"exampleFix":"// before\n@RepositoryDefinition(domainClass = User.class, idClass = Long.class)\npublic interface UserRepository extends CrudRepository<User, Long> {}\n// after (choose one style)\n@RepositoryDefinition(domainClass = User.class, idClass = Long.class)\npublic interface UserRepository {}\n// or\npublic interface UserRepository extends CrudRepository<User, Long> {}","handlingStrategy":"validation","validationCode":"// Fail fast in an architecture test:\n// assertThat(repoClass.isAnnotationPresent(RepositoryDefinition.class)\n//     && Arrays.stream(repoClass.getInterfaces()).anyMatch(i -> SUPPORTED.contains(i.getName()))).isFalse();","typeGuard":null,"tryCatchPattern":"try {\n    // repository bootstrap at app start\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"@RepositoryDefinition cannot also extend\")) {\n        throw new IllegalStateException(\"Pick one repository style: \" + e.getMessage());\n    }\n    throw e;\n}","preventionTips":["Choose one style per repository: either @RepositoryDefinition or extending a supported interface","Don't add @RepositoryDefinition to interfaces that already extend CrudRepository/JpaRepository","Run an ArchUnit or build-time check over repository interfaces in CI"],"tags":["spring-data","repository-definition","build-time","configuration"],"backgroundTag":"conflicting-repository-definition","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}