refactor: 优化配置

This commit is contained in:
zhouhao
2025-05-23 14:55:47 +08:00
parent 64257a2a94
commit abffaeee52
3 changed files with 26 additions and 10 deletions

View File

@@ -57,15 +57,6 @@ public class EasyormConfiguration {
}
@Bean
@ConditionalOnMissingBean
public EntityFactory entityFactory(ObjectProvider<EntityMappingCustomizer> customizers) {
MapperEntityFactory factory = new MapperEntityFactory();
for (EntityMappingCustomizer customizer : customizers) {
customizer.custom(factory);
}
return factory;
}
@Bean
@Primary

View File

@@ -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<EntityMappingCustomizer> customizers) {
MapperEntityFactory factory = new MapperEntityFactory();
for (EntityMappingCustomizer customizer : customizers) {
customizer.custom(factory);
}
return factory;
}
}

View File

@@ -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
org.hswebframework.web.crud.web.CommonWebMvcConfiguration
org.hswebframework.web.crud.configuration.EntityFactoryConfiguration