diff --git a/hsweb-boost/hsweb-boost-excel/src/test/resources/test.xls b/hsweb-boost/hsweb-boost-excel/src/test/resources/test.xls index b7586dc1f..5cf009a35 100644 Binary files a/hsweb-boost/hsweb-boost-excel/src/test/resources/test.xls and b/hsweb-boost/hsweb-boost-excel/src/test/resources/test.xls differ diff --git a/hsweb-commons/hsweb-commons-utils/src/main/java/org/hswebframework/web/ApplicationContextHolder.java b/hsweb-commons/hsweb-commons-utils/src/main/java/org/hswebframework/web/ApplicationContextHolder.java index 4212f7911..719291fa4 100644 --- a/hsweb-commons/hsweb-commons-utils/src/main/java/org/hswebframework/web/ApplicationContextHolder.java +++ b/hsweb-commons/hsweb-commons-utils/src/main/java/org/hswebframework/web/ApplicationContextHolder.java @@ -1,14 +1,15 @@ package org.hswebframework.web; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; import org.springframework.stereotype.Component; /** * @author zhouhao + * @since 2.0 */ @Component -public class ApplicationContextHolder { +public class ApplicationContextHolder implements ApplicationContextAware { private static ApplicationContext context; public static ApplicationContext get() { @@ -18,10 +19,10 @@ public class ApplicationContextHolder { return context; } - @Autowired - public void setContext(ApplicationContext context) { + @Override + public void setApplicationContext(ApplicationContext applicationContext) { if (null == ApplicationContextHolder.context) { - ApplicationContextHolder.context = context; + ApplicationContextHolder.context = applicationContext; } } } diff --git a/hsweb-starter/hsweb-spring-boot-starter/src/main/java/org/hswebframework/web/starter/HswebAutoConfiguration.java b/hsweb-starter/hsweb-spring-boot-starter/src/main/java/org/hswebframework/web/starter/HswebAutoConfiguration.java index ebc3b00b2..f32609c1e 100644 --- a/hsweb-starter/hsweb-spring-boot-starter/src/main/java/org/hswebframework/web/starter/HswebAutoConfiguration.java +++ b/hsweb-starter/hsweb-spring-boot-starter/src/main/java/org/hswebframework/web/starter/HswebAutoConfiguration.java @@ -24,12 +24,12 @@ 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.hswebframework.web.ApplicationContextHolder; import org.hswebframework.web.ThreadLocalUtils; import org.hswebframework.web.bean.FastBeanCopier; import org.hswebframework.web.commons.entity.factory.EntityFactory; import org.hswebframework.web.commons.entity.factory.MapperEntityFactory; import org.hswebframework.web.convert.CustomMessageConverter; -import org.hswebframework.web.dict.EnumDict; import org.hswebframework.web.service.DefaultLogicPrimaryKeyValidator; import org.hswebframework.web.starter.convert.FastJsonGenericHttpMessageConverter; import org.hswebframework.web.starter.convert.FastJsonHttpMessageConverter; @@ -47,7 +47,6 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; import org.springframework.web.method.support.HandlerMethodArgumentResolver; @@ -59,9 +58,6 @@ 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.util.List; @@ -70,7 +66,6 @@ import java.util.List; * @author zhouhao */ @Configuration -//@ComponentScan("org.hswebframework.web") @EnableConfigurationProperties(EntityProperties.class) @ImportAutoConfiguration(EntityFactoryInitConfiguration.class) public class HswebAutoConfiguration { @@ -203,6 +198,11 @@ public class HswebAutoConfiguration { } } + @Bean + public ApplicationContextHolder applicationContextHolder() { + return new ApplicationContextHolder(); + } + @Bean public RestControllerExceptionTranslator restControllerExceptionTranslator() { return new RestControllerExceptionTranslator();