REQ-2596-修复bean工具类获取bean报错问题
This commit is contained in:
parent
af553bb730
commit
af26c4bb6d
@ -4,12 +4,12 @@ import org.springframework.lang.Nullable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class SpringContentUtils {
|
||||
public class SpringContextUtils {
|
||||
|
||||
private static SpringContentUtils.SpringContext springContext;
|
||||
private static SpringContextUtils.SpringContext springContext;
|
||||
|
||||
public SpringContentUtils(SpringContentUtils.SpringContext springContext) {
|
||||
SpringContentUtils.springContext = springContext;
|
||||
public SpringContextUtils(SpringContextUtils.SpringContext springContext) {
|
||||
SpringContextUtils.springContext = springContext;
|
||||
}
|
||||
|
||||
public static <T> T getBean(Class<T> clazz) {
|
||||
@ -1,6 +1,6 @@
|
||||
package cn.axzo.workflow.core.conf;
|
||||
|
||||
import cn.axzo.workflow.core.common.utils.SpringContentUtils;
|
||||
import cn.axzo.workflow.core.common.utils.SpringContextUtils;
|
||||
import cn.axzo.workflow.core.engine.behavior.CustomActivityBehaviorFactory;
|
||||
import cn.axzo.workflow.core.engine.cmd.CustomCommandContextFactory;
|
||||
import cn.axzo.workflow.core.engine.id.BasedNacosSnowflakeIdGenerator;
|
||||
@ -22,7 +22,6 @@ import cn.axzo.workflow.core.service.ExtAxHiTaskInstService;
|
||||
import com.alibaba.cloud.nacos.NacosDiscoveryProperties;
|
||||
import com.alibaba.cloud.nacos.NacosServiceManager;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.flowable.common.engine.api.delegate.event.FlowableEventListener;
|
||||
import org.flowable.common.engine.impl.history.HistoryLevel;
|
||||
import org.flowable.form.spring.SpringFormEngineConfiguration;
|
||||
@ -32,11 +31,11 @@ import org.flowable.spring.boot.EngineConfigurationConfigurer;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
|
||||
@ -119,9 +118,14 @@ public class FlowableConfiguration {
|
||||
return new CustomActivityBehaviorFactory();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Order
|
||||
public SpringContextUtils springContextUtils(SpringContext springContext) {
|
||||
return new SpringContextUtils(springContext);
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnBean({SqlSessionFactory.class})
|
||||
public static class SpringContext implements SpringContentUtils.SpringContext, ApplicationContextAware {
|
||||
public static class SpringContext implements SpringContextUtils.SpringContext, ApplicationContextAware {
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
public SpringContext() {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package cn.axzo.workflow.core.version;
|
||||
|
||||
|
||||
import cn.axzo.workflow.core.common.utils.SpringContentUtils;
|
||||
import cn.axzo.workflow.core.common.utils.SpringContextUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@ -23,7 +23,7 @@ public class MultiVersionBeanUtils {
|
||||
* @return
|
||||
*/
|
||||
public static <T extends Versioned> T getSpecifiedVersionBean(Class<T> clazz, String version) {
|
||||
Map<String, T> beans = SpringContentUtils.getBeansOfType(clazz);
|
||||
Map<String, T> beans = SpringContextUtils.getBeansOfType(clazz);
|
||||
if (CollectionUtils.isEmpty(beans)) {
|
||||
throw new NullPointerException("no beans of type " + clazz.getName());
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user