diff --git a/modules/core/vehicle-identity/src/main/java/com/lingniu/ingest/identity/config/VehicleIdentityAutoConfiguration.java b/modules/core/vehicle-identity/src/main/java/com/lingniu/ingest/identity/config/VehicleIdentityAutoConfiguration.java index 59257be4..a9521b2a 100644 --- a/modules/core/vehicle-identity/src/main/java/com/lingniu/ingest/identity/config/VehicleIdentityAutoConfiguration.java +++ b/modules/core/vehicle-identity/src/main/java/com/lingniu/ingest/identity/config/VehicleIdentityAutoConfiguration.java @@ -23,6 +23,18 @@ public class VehicleIdentityAutoConfiguration { return new ObjectMapper(); } + @Bean + @ConditionalOnProperty(prefix = "lingniu.ingest.identity", name = "store", havingValue = "file") + public Object rejectedLegacyFileIdentityStore() { + throw new IllegalStateException("identity.store=file has been removed; configure identity.store=mysql"); + } + + @Bean + @ConditionalOnProperty(prefix = "lingniu.ingest.identity", name = "store", havingValue = "sqlite") + public Object rejectedLegacySqliteIdentityStore() { + throw new IllegalStateException("identity.store=sqlite has been removed; configure identity.store=mysql"); + } + @Bean @ConditionalOnMissingBean({VehicleIdentityResolver.class, VehicleIdentityRegistry.class}) @ConditionalOnProperty(prefix = "lingniu.ingest.identity", name = "store", havingValue = "mysql", diff --git a/modules/core/vehicle-identity/src/test/java/com/lingniu/ingest/identity/config/VehicleIdentityAutoConfigurationTest.java b/modules/core/vehicle-identity/src/test/java/com/lingniu/ingest/identity/config/VehicleIdentityAutoConfigurationTest.java index 79bfe1f1..a2b04703 100644 --- a/modules/core/vehicle-identity/src/test/java/com/lingniu/ingest/identity/config/VehicleIdentityAutoConfigurationTest.java +++ b/modules/core/vehicle-identity/src/test/java/com/lingniu/ingest/identity/config/VehicleIdentityAutoConfigurationTest.java @@ -51,12 +51,22 @@ class VehicleIdentityAutoConfigurationTest { } @Test - void unsupportedStoreModeDoesNotCreateRuntimeFallback() { + void rejectsLegacyFileStoreMode() { runner .withPropertyValues("lingniu.ingest.identity.store=file") - .run(context -> { - assertThat(context).doesNotHaveBean(VehicleIdentityResolver.class); - assertThat(context).doesNotHaveBean(VehicleIdentityRegistry.class); - }); + .run(context -> assertThat(context.getStartupFailure()) + .hasRootCauseInstanceOf(IllegalStateException.class) + .hasMessageContaining("identity.store=file has been removed") + .hasMessageContaining("identity.store=mysql")); + } + + @Test + void rejectsLegacySqliteStoreMode() { + runner + .withPropertyValues("lingniu.ingest.identity.store=sqlite") + .run(context -> assertThat(context.getStartupFailure()) + .hasRootCauseInstanceOf(IllegalStateException.class) + .hasMessageContaining("identity.store=sqlite has been removed") + .hasMessageContaining("identity.store=mysql")); } }