diff --git a/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/configuration/EasyormConfiguration.java b/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/configuration/EasyormConfiguration.java index 68d48c0bd..0c0c47729 100644 --- a/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/configuration/EasyormConfiguration.java +++ b/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/configuration/EasyormConfiguration.java @@ -57,15 +57,6 @@ public class EasyormConfiguration { } - @Bean - @ConditionalOnMissingBean - public EntityFactory entityFactory(ObjectProvider customizers) { - MapperEntityFactory factory = new MapperEntityFactory(); - for (EntityMappingCustomizer customizer : customizers) { - customizer.custom(factory); - } - return factory; - } @Bean @Primary diff --git a/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/configuration/EntityFactoryConfiguration.java b/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/configuration/EntityFactoryConfiguration.java new file mode 100644 index 000000000..3c75b74f8 --- /dev/null +++ b/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/configuration/EntityFactoryConfiguration.java @@ -0,0 +1,24 @@ +package org.hswebframework.web.crud.configuration; + +import org.hswebframework.web.api.crud.entity.EntityFactory; +import org.hswebframework.web.crud.entity.factory.EntityMappingCustomizer; +import org.hswebframework.web.crud.entity.factory.MapperEntityFactory; +import org.springframework.beans.factory.ObjectProvider; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.context.annotation.Bean; + +@AutoConfiguration +public class EntityFactoryConfiguration { + + @Bean + @ConditionalOnMissingBean + public EntityFactory entityFactory(ObjectProvider customizers) { + MapperEntityFactory factory = new MapperEntityFactory(); + for (EntityMappingCustomizer customizer : customizers) { + customizer.custom(factory); + } + return factory; + } + +} diff --git a/hsweb-commons/hsweb-commons-crud/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/hsweb-commons/hsweb-commons-crud/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index b54296e48..30062031c 100644 --- a/hsweb-commons/hsweb-commons-crud/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/hsweb-commons/hsweb-commons-crud/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -2,4 +2,5 @@ org.hswebframework.web.crud.configuration.EasyormConfiguration org.hswebframework.web.crud.configuration.JdbcSqlExecutorConfiguration org.hswebframework.web.crud.configuration.R2dbcSqlExecutorConfiguration org.hswebframework.web.crud.web.CommonWebFluxConfiguration -org.hswebframework.web.crud.web.CommonWebMvcConfiguration \ No newline at end of file +org.hswebframework.web.crud.web.CommonWebMvcConfiguration +org.hswebframework.web.crud.configuration.EntityFactoryConfiguration \ No newline at end of file