mirror of
https://github.com/hs-web/hsweb-framework.git
synced 2026-05-23 01:39:35 +08:00
refactor: 优化配置
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user