|
@@ -24,22 +24,18 @@ import com.alibaba.fastjson.parser.ParserConfig;
|
|
|
import com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer;
|
|
|
import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer;
|
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
|
-import org.hsweb.ezorm.rdb.executor.AbstractJdbcSqlExecutor;
|
|
|
-import org.hsweb.ezorm.rdb.executor.SqlExecutor;
|
|
|
import org.hswebframework.web.ThreadLocalUtils;
|
|
|
import org.hswebframework.web.commons.entity.Entity;
|
|
|
import org.hswebframework.web.commons.entity.factory.EntityFactory;
|
|
|
import org.hswebframework.web.commons.entity.factory.MapperEntityFactory;
|
|
|
-import org.hswebframework.web.commons.entity.factory.PropertyCopier;
|
|
|
import org.hswebframework.web.commons.model.Model;
|
|
|
-import org.hswebframework.web.dao.datasource.DataSourceHolder;
|
|
|
-import org.hswebframework.web.dao.datasource.DatabaseType;
|
|
|
import org.hswebframework.web.starter.convert.FastJsonHttpMessageConverter;
|
|
|
+import org.hswebframework.web.starter.entity.EntityFactoryInitConfiguration;
|
|
|
+import org.hswebframework.web.starter.entity.EntityProperties;
|
|
|
import org.hswebframework.web.starter.resolver.AuthorizationArgumentResolver;
|
|
|
import org.hswebframework.web.starter.resolver.JsonParamResolver;
|
|
|
-import org.springframework.beans.BeansException;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.beans.factory.config.BeanPostProcessor;
|
|
|
+import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
|
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
@@ -56,14 +52,11 @@ import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
-import javax.sql.DataSource;
|
|
|
import javax.validation.Validation;
|
|
|
import javax.validation.Validator;
|
|
|
import javax.validation.ValidatorFactory;
|
|
|
import java.lang.reflect.Modifier;
|
|
|
import java.lang.reflect.Type;
|
|
|
-import java.sql.Connection;
|
|
|
-import java.sql.SQLException;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@@ -74,6 +67,7 @@ import java.util.List;
|
|
|
@Configuration
|
|
|
@ComponentScan("org.hswebframework.web")
|
|
|
@EnableConfigurationProperties(EntityProperties.class)
|
|
|
+@ImportAutoConfiguration(EntityFactoryInitConfiguration.class)
|
|
|
public class HswebAutoConfiguration {
|
|
|
|
|
|
@Autowired
|
|
@@ -158,30 +152,13 @@ public class HswebAutoConfiguration {
|
|
|
|
|
|
@Bean(name = "entityFactory")
|
|
|
@ConditionalOnMissingBean(EntityFactory.class)
|
|
|
- public EntityFactory entityFactory() {
|
|
|
+ public MapperEntityFactory mapperEntityFactory() {
|
|
|
return new MapperEntityFactory(entityProperties.createMappers());
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- @Configuration
|
|
|
+ @Bean
|
|
|
@ConditionalOnBean(MapperEntityFactory.class)
|
|
|
- public class EntityFactoryInitConfiguration implements BeanPostProcessor {
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private MapperEntityFactory mapperEntityFactory;
|
|
|
-
|
|
|
-
|
|
|
- @Override
|
|
|
- public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
|
|
|
- return bean;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
|
|
|
- if (bean instanceof PropertyCopier) {
|
|
|
- mapperEntityFactory.addCopier(((PropertyCopier) bean));
|
|
|
- }
|
|
|
- return bean;
|
|
|
- }
|
|
|
+ public EntityFactoryInitConfiguration entityFactoryInitConfiguration() {
|
|
|
+ return new EntityFactoryInitConfiguration();
|
|
|
}
|
|
|
}
|