From 6adbe1de7ace2c9e72559f622a5f002c6ca0ce62 Mon Sep 17 00:00:00 2001 From: Leon van Zantvoort Date: Fri, 6 Mar 2026 12:03:57 +0100 Subject: [PATCH 1/2] Fix repository scanner registering non-Repository interfaces in scanned packages. (#67) --- README.md | 6 ++-- docs/api-java.md | 8 ++--- docs/api-kotlin.md | 14 ++++----- docs/dialects.md | 30 +++++++++---------- docs/index.md | 4 +-- docs/installation.md | 18 +++++------ docs/json.md | 10 +++---- docs/metamodel.md | 6 ++-- docs/spring-integration.md | 16 +++++----- pom.xml | 2 +- storm-bom/pom.xml | 2 +- storm-core/pom.xml | 2 +- storm-foundation/pom.xml | 2 +- storm-jackson2/pom.xml | 2 +- storm-jackson3/pom.xml | 2 +- storm-java21/pom.xml | 2 +- storm-kotlin-spring-boot-starter/pom.xml | 2 +- storm-kotlin-spring/pom.xml | 2 +- .../RepositoryBeanFactoryPostProcessor.kt | 5 ---- .../kotlin/st/orm/spring/RepositoryTest.kt | 11 +++++++ storm-kotlin-validator/pom.xml | 4 +-- storm-kotlin/pom.xml | 2 +- storm-kotlinx-serialization/pom.xml | 4 +-- storm-mariadb/pom.xml | 2 +- storm-metamodel-ksp/pom.xml | 2 +- storm-metamodel-processor/pom.xml | 2 +- storm-mssqlserver/pom.xml | 2 +- storm-mysql/pom.xml | 2 +- storm-oracle/pom.xml | 2 +- storm-postgresql/pom.xml | 2 +- storm-spring-boot-starter/pom.xml | 2 +- storm-spring/pom.xml | 2 +- .../RepositoryBeanFactoryPostProcessor.java | 6 ---- .../java/st/orm/spring/RepositoryTest.java | 14 ++++++++- storm-test/pom.xml | 2 +- 35 files changed, 104 insertions(+), 92 deletions(-) diff --git a/README.md b/README.md index 1791302b4..d9d206975 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ Storm provides a Bill of Materials (BOM) for centralized version management. Imp st.orm storm-bom - 1.9.0 + 1.9.1 pom import @@ -153,7 +153,7 @@ Storm provides a Bill of Materials (BOM) for centralized version management. Imp ```kotlin dependencies { - implementation(platform("st.orm:storm-bom:1.9.0")) + implementation(platform("st.orm:storm-bom:1.9.1")) } ``` @@ -163,7 +163,7 @@ With the BOM imported, add Storm modules without specifying versions: ```kotlin dependencies { - implementation(platform("st.orm:storm-bom:1.9.0")) + implementation(platform("st.orm:storm-bom:1.9.1")) implementation("st.orm:storm-kotlin") runtimeOnly("st.orm:storm-core") } diff --git a/docs/api-java.md b/docs/api-java.md index b82cf2a5a..0ac031efa 100644 --- a/docs/api-java.md +++ b/docs/api-java.md @@ -16,7 +16,7 @@ The main Java API module. It provides the `ORMTemplate` entry point, repository st.orm storm-java21 - 1.9.0 + 1.9.1 ``` @@ -44,7 +44,7 @@ Spring Framework integration for Java. Provides `RepositoryBeanFactoryPostProces st.orm storm-spring - 1.9.0 + 1.9.1 ``` @@ -58,7 +58,7 @@ Spring Boot auto-configuration for Java. Automatically creates an `ORMTemplate` st.orm storm-spring-boot-starter - 1.9.0 + 1.9.1 ``` @@ -83,7 +83,7 @@ The `storm-metamodel-processor` annotation processor generates type-safe metamod st.orm storm-metamodel-processor - 1.9.0 + 1.9.1 provided ``` diff --git a/docs/api-kotlin.md b/docs/api-kotlin.md index 57f54daef..d44b3e879 100644 --- a/docs/api-kotlin.md +++ b/docs/api-kotlin.md @@ -14,7 +14,7 @@ The main Kotlin API module. It provides the `ORMTemplate` interface, extension f ```kotlin // Gradle (Kotlin DSL) -implementation("st.orm:storm-kotlin:1.9.0") +implementation("st.orm:storm-kotlin:1.9.1") ``` ```xml @@ -22,7 +22,7 @@ implementation("st.orm:storm-kotlin:1.9.0") st.orm storm-kotlin - 1.9.0 + 1.9.1 ``` @@ -33,7 +33,7 @@ The Kotlin API does not depend on any preview features. All APIs are stable and Spring Framework integration for Kotlin. Provides `RepositoryBeanFactoryPostProcessor` for repository auto-discovery and injection, `@EnableTransactionIntegration` for bridging Storm's programmatic transactions with Spring's `@Transactional`, and transaction-aware coroutine support. Add this module when you use Spring Framework without Spring Boot. ```kotlin -implementation("st.orm:storm-kotlin-spring:1.9.0") +implementation("st.orm:storm-kotlin-spring:1.9.1") ``` See [Spring Integration](spring-integration.md) for configuration details. @@ -43,7 +43,7 @@ See [Spring Integration](spring-integration.md) for configuration details. Spring Boot auto-configuration for Kotlin. Automatically creates an `ORMTemplate` bean from the `DataSource`, discovers repositories, enables transaction integration, and binds `storm.*` properties from `application.yml`. This is the recommended dependency for Spring Boot applications. ```kotlin -implementation("st.orm:storm-kotlin-spring-boot-starter:1.9.0") +implementation("st.orm:storm-kotlin-spring-boot-starter:1.9.1") ``` See [Spring Integration: Spring Boot Starter](spring-integration.md#spring-boot-starter) for what the starter provides and how to override its defaults. @@ -53,7 +53,7 @@ See [Spring Integration: Spring Boot Starter](spring-integration.md#spring-boot- Validation support for Kotlin entities. Provides integration with Kotlin validation libraries for entity constraint checking. ```kotlin -implementation("st.orm:storm-kotlin-validator:1.9.0") +implementation("st.orm:storm-kotlin-validator:1.9.1") ``` ## Key Classes and Functions @@ -104,7 +104,7 @@ plugins { } dependencies { - ksp("st.orm:storm-metamodel-ksp:1.9.0") + ksp("st.orm:storm-metamodel-ksp:1.9.1") } ``` @@ -123,7 +123,7 @@ dependencies { st.orm storm-metamodel-processor - 1.9.0 + 1.9.1 diff --git a/docs/dialects.md b/docs/dialects.md index 96a5d8c9a..7b24b775a 100644 --- a/docs/dialects.md +++ b/docs/dialects.md @@ -27,7 +27,7 @@ Add the dialect dependency for your database. Dialects are runtime-only dependen st.orm storm-postgresql - 1.9.0 + 1.9.1 runtime @@ -35,7 +35,7 @@ Add the dialect dependency for your database. Dialects are runtime-only dependen st.orm storm-mysql - 1.9.0 + 1.9.1 runtime @@ -43,7 +43,7 @@ Add the dialect dependency for your database. Dialects are runtime-only dependen st.orm storm-mariadb - 1.9.0 + 1.9.1 runtime @@ -51,7 +51,7 @@ Add the dialect dependency for your database. Dialects are runtime-only dependen st.orm storm-oracle - 1.9.0 + 1.9.1 runtime @@ -59,7 +59,7 @@ Add the dialect dependency for your database. Dialects are runtime-only dependen st.orm storm-mssqlserver - 1.9.0 + 1.9.1 runtime ``` @@ -68,38 +68,38 @@ Add the dialect dependency for your database. Dialects are runtime-only dependen ```groovy // PostgreSQL -runtimeOnly 'st.orm:storm-postgresql:1.9.0' +runtimeOnly 'st.orm:storm-postgresql:1.9.1' // MySQL -runtimeOnly 'st.orm:storm-mysql:1.9.0' +runtimeOnly 'st.orm:storm-mysql:1.9.1' // MariaDB -runtimeOnly 'st.orm:storm-mariadb:1.9.0' +runtimeOnly 'st.orm:storm-mariadb:1.9.1' // Oracle -runtimeOnly 'st.orm:storm-oracle:1.9.0' +runtimeOnly 'st.orm:storm-oracle:1.9.1' // MS SQL Server -runtimeOnly 'st.orm:storm-mssqlserver:1.9.0' +runtimeOnly 'st.orm:storm-mssqlserver:1.9.1' ``` ### Gradle (Kotlin DSL) ```kotlin // PostgreSQL -runtimeOnly("st.orm:storm-postgresql:1.9.0") +runtimeOnly("st.orm:storm-postgresql:1.9.1") // MySQL -runtimeOnly("st.orm:storm-mysql:1.9.0") +runtimeOnly("st.orm:storm-mysql:1.9.1") // MariaDB -runtimeOnly("st.orm:storm-mariadb:1.9.0") +runtimeOnly("st.orm:storm-mariadb:1.9.1") // Oracle -runtimeOnly("st.orm:storm-oracle:1.9.0") +runtimeOnly("st.orm:storm-oracle:1.9.1") // MS SQL Server -runtimeOnly("st.orm:storm-mssqlserver:1.9.0") +runtimeOnly("st.orm:storm-mssqlserver:1.9.1") ``` ## Automatic Detection diff --git a/docs/index.md b/docs/index.md index ac22952cf..637a49366 100644 --- a/docs/index.md +++ b/docs/index.md @@ -139,7 +139,7 @@ Storm provides a Bill of Materials (BOM) for centralized version management. Imp ```kotlin dependencies { - implementation(platform("st.orm:storm-bom:1.9.0")) + implementation(platform("st.orm:storm-bom:1.9.1")) implementation("st.orm:storm-kotlin") runtimeOnly("st.orm:storm-core") } @@ -154,7 +154,7 @@ dependencies { st.orm storm-bom - 1.9.0 + 1.9.1 pom import diff --git a/docs/installation.md b/docs/installation.md index 63368a055..90c3db8a1 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -27,7 +27,7 @@ Storm provides a Bill of Materials (BOM) for centralized version management. Imp ```kotlin dependencies { - implementation(platform("st.orm:storm-bom:1.9.0")) + implementation(platform("st.orm:storm-bom:1.9.1")) } ``` @@ -39,7 +39,7 @@ dependencies { st.orm storm-bom - 1.9.0 + 1.9.1 pom import @@ -58,7 +58,7 @@ dependencies { st.orm storm-bom - 1.9.0 + 1.9.1 pom import @@ -70,7 +70,7 @@ dependencies { ```kotlin dependencies { - implementation(platform("st.orm:storm-bom:1.9.0")) + implementation(platform("st.orm:storm-bom:1.9.1")) } ``` @@ -86,7 +86,7 @@ dependencies { ```kotlin dependencies { - implementation(platform("st.orm:storm-bom:1.9.0")) + implementation(platform("st.orm:storm-bom:1.9.1")) implementation("st.orm:storm-kotlin") } @@ -121,7 +121,7 @@ dependencies { ```kotlin dependencies { - implementation(platform("st.orm:storm-bom:1.9.0")) + implementation(platform("st.orm:storm-bom:1.9.1")) implementation("st.orm:storm-java21") } @@ -182,7 +182,7 @@ plugins { } dependencies { - ksp("st.orm:storm-metamodel-ksp:1.9.0") + ksp("st.orm:storm-metamodel-ksp:1.9.1") } ``` @@ -201,7 +201,7 @@ dependencies { st.orm storm-metamodel-processor - 1.9.0 + 1.9.1 @@ -227,7 +227,7 @@ dependencies { ```kotlin dependencies { - annotationProcessor("st.orm:storm-metamodel-processor:1.9.0") + annotationProcessor("st.orm:storm-metamodel-processor:1.9.1") } ``` diff --git a/docs/json.md b/docs/json.md index b58d743bb..4c8420bca 100644 --- a/docs/json.md +++ b/docs/json.md @@ -19,12 +19,12 @@ Works with both Kotlin and Java projects. Two variants are available, matching t st.orm storm-jackson2 - 1.9.0 + 1.9.1 ``` ```groovy -implementation 'st.orm:storm-jackson2:1.9.0' +implementation 'st.orm:storm-jackson2:1.9.1' ``` **Jackson 3** (requires Jackson 3.0+): @@ -33,12 +33,12 @@ implementation 'st.orm:storm-jackson2:1.9.0' st.orm storm-jackson3 - 1.9.0 + 1.9.1 ``` ```groovy -implementation 'st.orm:storm-jackson3:1.9.0' +implementation 'st.orm:storm-jackson3:1.9.1' ``` The two modules are mutually exclusive on the classpath. Both provide the same public API (`st.orm.jackson` package), so switching between them requires only changing the Maven dependency. @@ -53,7 +53,7 @@ plugins { } dependencies { - implementation("st.orm:storm-kotlinx-serialization:1.9.0") + implementation("st.orm:storm-kotlinx-serialization:1.9.1") } ``` diff --git a/docs/metamodel.md b/docs/metamodel.md index 4ab65ea1e..1d7a8c8b0 100644 --- a/docs/metamodel.md +++ b/docs/metamodel.md @@ -49,14 +49,14 @@ plugins { } dependencies { - ksp("st.orm:storm-metamodel-processor:1.9.0") + ksp("st.orm:storm-metamodel-processor:1.9.1") } ``` ### Gradle (Java) ```kotlin -annotationProcessor("st.orm:storm-metamodel-processor:1.9.0") +annotationProcessor("st.orm:storm-metamodel-processor:1.9.1") ``` ### Maven (Java) @@ -65,7 +65,7 @@ annotationProcessor("st.orm:storm-metamodel-processor:1.9.0") st.orm storm-metamodel-processor - 1.9.0 + 1.9.1 provided ``` diff --git a/docs/spring-integration.md b/docs/spring-integration.md index e02b06425..96954b2fb 100644 --- a/docs/spring-integration.md +++ b/docs/spring-integration.md @@ -18,7 +18,7 @@ The starter modules provide zero-configuration setup: an `ORMTemplate` bean is c ```kotlin // Gradle (Kotlin DSL) -implementation("st.orm:storm-kotlin-spring-boot-starter:1.9.0") +implementation("st.orm:storm-kotlin-spring-boot-starter:1.9.1") ``` ```xml @@ -26,7 +26,7 @@ implementation("st.orm:storm-kotlin-spring-boot-starter:1.9.0") st.orm storm-kotlin-spring-boot-starter - 1.9.0 + 1.9.1 ``` @@ -38,13 +38,13 @@ implementation("st.orm:storm-kotlin-spring-boot-starter:1.9.0") st.orm storm-spring-boot-starter - 1.9.0 + 1.9.1 ``` ```kotlin // Gradle (Kotlin DSL) -implementation("st.orm:storm-spring-boot-starter:1.9.0") +implementation("st.orm:storm-spring-boot-starter:1.9.1") ``` @@ -59,7 +59,7 @@ If you prefer manual configuration, or need to customize the setup beyond what t ```kotlin // Gradle (Kotlin DSL) -implementation("st.orm:storm-kotlin-spring:1.9.0") +implementation("st.orm:storm-kotlin-spring:1.9.1") ``` ```xml @@ -67,7 +67,7 @@ implementation("st.orm:storm-kotlin-spring:1.9.0") st.orm storm-kotlin-spring - 1.9.0 + 1.9.1 ``` @@ -79,13 +79,13 @@ implementation("st.orm:storm-kotlin-spring:1.9.0") st.orm storm-spring - 1.9.0 + 1.9.1 ``` ```kotlin // Gradle (Kotlin DSL) -implementation("st.orm:storm-spring:1.9.0") +implementation("st.orm:storm-spring:1.9.1") ``` diff --git a/pom.xml b/pom.xml index ee53e5e99..07666d3d7 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ st.orm storm-framework - 1.9.0 + 1.9.1 pom Storm Framework A SQL Template and ORM framework, focusing on modernizing and simplifying database programming. diff --git a/storm-bom/pom.xml b/storm-bom/pom.xml index 112918ed6..eaa70e90d 100644 --- a/storm-bom/pom.xml +++ b/storm-bom/pom.xml @@ -6,7 +6,7 @@ st.orm storm-framework - 1.9.0 + 1.9.1 ../pom.xml storm-bom diff --git a/storm-core/pom.xml b/storm-core/pom.xml index 15857f34b..51d50f8fd 100644 --- a/storm-core/pom.xml +++ b/storm-core/pom.xml @@ -6,7 +6,7 @@ st.orm storm-framework - 1.9.0 + 1.9.1 ../pom.xml storm-core diff --git a/storm-foundation/pom.xml b/storm-foundation/pom.xml index 802fb4152..25cdd34cd 100644 --- a/storm-foundation/pom.xml +++ b/storm-foundation/pom.xml @@ -6,7 +6,7 @@ st.orm storm-framework - 1.9.0 + 1.9.1 ../pom.xml storm-foundation diff --git a/storm-jackson2/pom.xml b/storm-jackson2/pom.xml index cb9de42f6..b4715dbad 100644 --- a/storm-jackson2/pom.xml +++ b/storm-jackson2/pom.xml @@ -6,7 +6,7 @@ st.orm storm-framework - 1.9.0 + 1.9.1 ../pom.xml storm-jackson2 diff --git a/storm-jackson3/pom.xml b/storm-jackson3/pom.xml index d27ef30bf..b054d59ee 100644 --- a/storm-jackson3/pom.xml +++ b/storm-jackson3/pom.xml @@ -6,7 +6,7 @@ st.orm storm-framework - 1.9.0 + 1.9.1 ../pom.xml storm-jackson3 diff --git a/storm-java21/pom.xml b/storm-java21/pom.xml index 4cbfe4510..56a5532f0 100644 --- a/storm-java21/pom.xml +++ b/storm-java21/pom.xml @@ -6,7 +6,7 @@ st.orm storm-framework - 1.9.0 + 1.9.1 ../pom.xml storm-java21 diff --git a/storm-kotlin-spring-boot-starter/pom.xml b/storm-kotlin-spring-boot-starter/pom.xml index 648f34ade..71087c949 100644 --- a/storm-kotlin-spring-boot-starter/pom.xml +++ b/storm-kotlin-spring-boot-starter/pom.xml @@ -6,7 +6,7 @@ st.orm storm-framework - 1.9.0 + 1.9.1 ../pom.xml storm-kotlin-spring-boot-starter diff --git a/storm-kotlin-spring/pom.xml b/storm-kotlin-spring/pom.xml index 277991d35..c996e4b2b 100644 --- a/storm-kotlin-spring/pom.xml +++ b/storm-kotlin-spring/pom.xml @@ -6,7 +6,7 @@ st.orm storm-framework - 1.9.0 + 1.9.1 ../pom.xml storm-kotlin-spring diff --git a/storm-kotlin-spring/src/main/kotlin/st/orm/spring/RepositoryBeanFactoryPostProcessor.kt b/storm-kotlin-spring/src/main/kotlin/st/orm/spring/RepositoryBeanFactoryPostProcessor.kt index ab8065667..e8c8b628f 100644 --- a/storm-kotlin-spring/src/main/kotlin/st/orm/spring/RepositoryBeanFactoryPostProcessor.kt +++ b/storm-kotlin-spring/src/main/kotlin/st/orm/spring/RepositoryBeanFactoryPostProcessor.kt @@ -31,7 +31,6 @@ import org.springframework.context.annotation.ClassPathScanningCandidateComponen import org.springframework.core.env.Environment import org.springframework.core.env.StandardEnvironment import org.springframework.core.io.ResourceLoader -import org.springframework.core.type.classreading.MetadataReader import org.springframework.core.type.filter.AssignableTypeFilter import org.springframework.stereotype.Component import org.springframework.util.ClassUtils @@ -76,10 +75,6 @@ open class RepositoryBeanFactoryPostProcessor : if (repositoryBasePackages.isEmpty()) return val registry = beanFactory as BeanDefinitionRegistry val scanner = object : ClassPathScanningCandidateComponentProvider(false, environment) { - override fun isCandidateComponent(metadataReader: MetadataReader): Boolean { - val metadata = metadataReader.classMetadata - return metadata.isIndependent && metadata.isInterface - } override fun isCandidateComponent(beanDefinition: AnnotatedBeanDefinition): Boolean { val metadata = beanDefinition.metadata return metadata.isIndependent && metadata.isInterface diff --git a/storm-kotlin-spring/src/test/kotlin/st/orm/spring/RepositoryTest.kt b/storm-kotlin-spring/src/test/kotlin/st/orm/spring/RepositoryTest.kt index 3afc86914..14c7ef118 100644 --- a/storm-kotlin-spring/src/test/kotlin/st/orm/spring/RepositoryTest.kt +++ b/storm-kotlin-spring/src/test/kotlin/st/orm/spring/RepositoryTest.kt @@ -1,8 +1,10 @@ package st.orm.spring +import io.kotest.matchers.booleans.shouldBeFalse import io.kotest.matchers.shouldBe import org.junit.jupiter.api.Test import org.springframework.boot.test.context.SpringBootTest +import org.springframework.context.ApplicationContext import org.springframework.context.annotation.Import import org.springframework.test.context.ContextConfiguration import org.springframework.test.context.TestConstructor @@ -20,6 +22,7 @@ import st.orm.spring.repository.VisitRepository class RepositoryTest( val visitRepository: VisitRepository, val ownerRepositoryTest: OwnerRepository?, + val applicationContext: ApplicationContext, ) { @Test @@ -35,4 +38,12 @@ class RepositoryTest( // should skip it during scanning. It should not be registered as a Spring bean. ownerRepositoryTest shouldBe null } + + @Test + fun `metamodel interface in repository package should not be registered as bean`() { + // PetMetamodel is a Metamodel interface in the same package as the repositories. + // It should NOT be picked up by RepositoryBeanFactoryPostProcessor because + // it does not extend Repository. + applicationContext.containsBean("PetMetamodel").shouldBeFalse() + } } diff --git a/storm-kotlin-validator/pom.xml b/storm-kotlin-validator/pom.xml index e3be65e66..9dad1c01b 100644 --- a/storm-kotlin-validator/pom.xml +++ b/storm-kotlin-validator/pom.xml @@ -6,7 +6,7 @@ st.orm storm-framework - 1.9.0 + 1.9.1 ../pom.xml @@ -191,4 +191,4 @@ - \ No newline at end of file + diff --git a/storm-kotlin/pom.xml b/storm-kotlin/pom.xml index e3492da3a..4744c4063 100644 --- a/storm-kotlin/pom.xml +++ b/storm-kotlin/pom.xml @@ -6,7 +6,7 @@ st.orm storm-framework - 1.9.0 + 1.9.1 ../pom.xml storm-kotlin diff --git a/storm-kotlinx-serialization/pom.xml b/storm-kotlinx-serialization/pom.xml index 7ea23ed91..b19692891 100644 --- a/storm-kotlinx-serialization/pom.xml +++ b/storm-kotlinx-serialization/pom.xml @@ -6,7 +6,7 @@ st.orm storm-framework - 1.9.0 + 1.9.1 ../pom.xml storm-kotlinx-serialization @@ -238,4 +238,4 @@ test - \ No newline at end of file + diff --git a/storm-mariadb/pom.xml b/storm-mariadb/pom.xml index 657a4d8f2..ee46939d9 100644 --- a/storm-mariadb/pom.xml +++ b/storm-mariadb/pom.xml @@ -6,7 +6,7 @@ st.orm storm-framework - 1.9.0 + 1.9.1 ../pom.xml storm-mariadb diff --git a/storm-metamodel-ksp/pom.xml b/storm-metamodel-ksp/pom.xml index 6eb22882c..3ff472152 100644 --- a/storm-metamodel-ksp/pom.xml +++ b/storm-metamodel-ksp/pom.xml @@ -5,7 +5,7 @@ st.orm storm-framework - 1.9.0 + 1.9.1 ../pom.xml storm-metamodel-ksp diff --git a/storm-metamodel-processor/pom.xml b/storm-metamodel-processor/pom.xml index 783933dd4..402301c4a 100644 --- a/storm-metamodel-processor/pom.xml +++ b/storm-metamodel-processor/pom.xml @@ -5,7 +5,7 @@ st.orm storm-framework - 1.9.0 + 1.9.1 ../pom.xml storm-metamodel-processor diff --git a/storm-mssqlserver/pom.xml b/storm-mssqlserver/pom.xml index 445319e8c..05ae1a1e4 100644 --- a/storm-mssqlserver/pom.xml +++ b/storm-mssqlserver/pom.xml @@ -6,7 +6,7 @@ st.orm storm-framework - 1.9.0 + 1.9.1 ../pom.xml storm-mssqlserver diff --git a/storm-mysql/pom.xml b/storm-mysql/pom.xml index 3d7157ce7..15a88ee77 100644 --- a/storm-mysql/pom.xml +++ b/storm-mysql/pom.xml @@ -6,7 +6,7 @@ st.orm storm-framework - 1.9.0 + 1.9.1 ../pom.xml storm-mysql diff --git a/storm-oracle/pom.xml b/storm-oracle/pom.xml index 5b61616a9..cc5d603ff 100644 --- a/storm-oracle/pom.xml +++ b/storm-oracle/pom.xml @@ -6,7 +6,7 @@ st.orm storm-framework - 1.9.0 + 1.9.1 ../pom.xml storm-oracle diff --git a/storm-postgresql/pom.xml b/storm-postgresql/pom.xml index 158124d53..bd9db2e8e 100644 --- a/storm-postgresql/pom.xml +++ b/storm-postgresql/pom.xml @@ -6,7 +6,7 @@ st.orm storm-framework - 1.9.0 + 1.9.1 ../pom.xml storm-postgresql diff --git a/storm-spring-boot-starter/pom.xml b/storm-spring-boot-starter/pom.xml index 66c9a9771..e501ef652 100644 --- a/storm-spring-boot-starter/pom.xml +++ b/storm-spring-boot-starter/pom.xml @@ -6,7 +6,7 @@ st.orm storm-framework - 1.9.0 + 1.9.1 ../pom.xml storm-spring-boot-starter diff --git a/storm-spring/pom.xml b/storm-spring/pom.xml index 4702e7df6..c6a1ae400 100644 --- a/storm-spring/pom.xml +++ b/storm-spring/pom.xml @@ -6,7 +6,7 @@ st.orm storm-framework - 1.9.0 + 1.9.1 ../pom.xml storm-spring diff --git a/storm-spring/src/main/java/st/orm/spring/RepositoryBeanFactoryPostProcessor.java b/storm-spring/src/main/java/st/orm/spring/RepositoryBeanFactoryPostProcessor.java index 2563efe72..aea138b4f 100644 --- a/storm-spring/src/main/java/st/orm/spring/RepositoryBeanFactoryPostProcessor.java +++ b/storm-spring/src/main/java/st/orm/spring/RepositoryBeanFactoryPostProcessor.java @@ -35,7 +35,6 @@ import org.springframework.core.env.Environment; import org.springframework.core.env.StandardEnvironment; import org.springframework.core.io.ResourceLoader; -import org.springframework.core.type.classreading.MetadataReader; import org.springframework.core.type.filter.AssignableTypeFilter; import org.springframework.stereotype.Component; import org.springframework.util.ClassUtils; @@ -78,11 +77,6 @@ public void postProcessBeanFactory(@Nonnull ConfigurableListableBeanFactory bean BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory; ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(false, environment) { - @Override - protected boolean isCandidateComponent(MetadataReader metadataReader) { - var md = metadataReader.getClassMetadata(); - return md.isIndependent() && md.isInterface(); - } @Override protected boolean isCandidateComponent(AnnotatedBeanDefinition beanDefinition) { var md = beanDefinition.getMetadata(); diff --git a/storm-spring/src/test/java/st/orm/spring/RepositoryTest.java b/storm-spring/src/test/java/st/orm/spring/RepositoryTest.java index dfce72b5f..43ef28294 100644 --- a/storm-spring/src/test/java/st/orm/spring/RepositoryTest.java +++ b/storm-spring/src/test/java/st/orm/spring/RepositoryTest.java @@ -1,12 +1,14 @@ package st.orm.spring; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNull; import static org.springframework.test.context.TestConstructor.AutowireMode.ALL; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Import; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestConstructor; @@ -24,10 +26,12 @@ public class RepositoryTest { private final VisitRepository visitRepository; private final OwnerRepository ownerRepository; + private final ApplicationContext applicationContext; - public RepositoryTest(VisitRepository visitRepository, @Autowired(required = false) OwnerRepository ownerRepository) { + public RepositoryTest(VisitRepository visitRepository, @Autowired(required = false) OwnerRepository ownerRepository, ApplicationContext applicationContext) { this.visitRepository = visitRepository; this.ownerRepository = ownerRepository; + this.applicationContext = applicationContext; } @Test @@ -44,4 +48,12 @@ public void ownerRepositoryShouldNotBeAutowiredDueToNoRepositoryBeanAnnotation() // should skip it during scanning. It should not be registered as a Spring bean. assertNull(ownerRepository); } + + @Test + public void metamodelInterfaceInRepositoryPackageShouldNotBeRegisteredAsBean() { + // PetMetamodel is a Metamodel interface in the same package as the repositories. + // It should NOT be picked up by RepositoryBeanFactoryPostProcessor because + // it does not extend Repository. + assertFalse(applicationContext.containsBean("PetMetamodel")); + } } diff --git a/storm-test/pom.xml b/storm-test/pom.xml index 621c51f5f..ab637256e 100644 --- a/storm-test/pom.xml +++ b/storm-test/pom.xml @@ -6,7 +6,7 @@ st.orm storm-framework - 1.9.0 + 1.9.1 ../pom.xml storm-test From 0d69786366680800d83005e91fa538d7c91c9472 Mon Sep 17 00:00:00 2001 From: Leon van Zantvoort Date: Fri, 6 Mar 2026 18:00:00 +0100 Subject: [PATCH 2/2] Add missing metamodels. (#67) --- .../kotlin/st/orm/spring/repository/PetMetamodel.kt | 9 +++++++++ .../java/st/orm/spring/repository/PetMetamodel.java | 11 +++++++++++ 2 files changed, 20 insertions(+) create mode 100644 storm-kotlin-spring/src/test/kotlin/st/orm/spring/repository/PetMetamodel.kt create mode 100644 storm-spring/src/test/java/st/orm/spring/repository/PetMetamodel.java diff --git a/storm-kotlin-spring/src/test/kotlin/st/orm/spring/repository/PetMetamodel.kt b/storm-kotlin-spring/src/test/kotlin/st/orm/spring/repository/PetMetamodel.kt new file mode 100644 index 000000000..0dd4003f8 --- /dev/null +++ b/storm-kotlin-spring/src/test/kotlin/st/orm/spring/repository/PetMetamodel.kt @@ -0,0 +1,9 @@ +package st.orm.spring.repository + +import st.orm.Metamodel + +/** + * Simulates a generated metamodel interface in the same package as repositories. + * This should NOT be picked up by [st.orm.spring.RepositoryBeanFactoryPostProcessor]. + */ +interface PetMetamodel : Metamodel diff --git a/storm-spring/src/test/java/st/orm/spring/repository/PetMetamodel.java b/storm-spring/src/test/java/st/orm/spring/repository/PetMetamodel.java new file mode 100644 index 000000000..e733bde21 --- /dev/null +++ b/storm-spring/src/test/java/st/orm/spring/repository/PetMetamodel.java @@ -0,0 +1,11 @@ +package st.orm.spring.repository; + +import st.orm.Metamodel; +import st.orm.spring.model.Pet; + +/** + * Simulates a generated metamodel interface in the same package as repositories. + * This should NOT be picked up by {@link st.orm.spring.RepositoryBeanFactoryPostProcessor}. + */ +public interface PetMetamodel extends Metamodel { +}