refactor:DynamicTp迁移spring模块且使用spi机制解决依赖循环
This commit is contained in:
parent
e1622bf1da
commit
eff32e0191
|
@ -9,5 +9,13 @@
|
|||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<artifactId>dynamic-tp-adapter-common</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.dromara.dynamictp</groupId>
|
||||
<artifactId>dynamic-tp-spring</artifactId>
|
||||
<version>1.1.8-beta</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -32,8 +32,6 @@ import org.dromara.dynamictp.common.entity.ThreadPoolStats;
|
|||
import org.dromara.dynamictp.common.entity.TpExecutorProps;
|
||||
import org.dromara.dynamictp.common.entity.TpMainFields;
|
||||
import org.dromara.dynamictp.common.properties.DtpProperties;
|
||||
import org.dromara.dynamictp.common.spring.ApplicationContextHolder;
|
||||
import org.dromara.dynamictp.common.spring.OnceApplicationContextEventListener;
|
||||
import org.dromara.dynamictp.common.util.ReflectionUtil;
|
||||
import org.dromara.dynamictp.common.util.StreamUtil;
|
||||
import org.dromara.dynamictp.core.aware.AwareManager;
|
||||
|
@ -44,6 +42,8 @@ import org.dromara.dynamictp.core.support.ExecutorWrapper;
|
|||
import org.dromara.dynamictp.core.support.ThreadPoolExecutorProxy;
|
||||
import org.dromara.dynamictp.core.support.task.wrapper.TaskWrapper;
|
||||
import org.dromara.dynamictp.core.support.task.wrapper.TaskWrappers;
|
||||
import org.dromara.dynamictp.spring.ex.ApplicationContextHolder;
|
||||
import org.dromara.dynamictp.spring.ex.OnceApplicationContextEventListener;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
|
||||
import java.util.Collections;
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
package org.dromara.dynamictp.adapter.common;
|
||||
|
||||
import org.dromara.dynamictp.common.spring.ApplicationContextHolder;
|
||||
import org.dromara.dynamictp.common.event.AlarmCheckEvent;
|
||||
import org.dromara.dynamictp.common.event.CollectEvent;
|
||||
import org.dromara.dynamictp.common.event.RefreshEvent;
|
||||
|
@ -26,6 +25,7 @@ import org.dromara.dynamictp.core.handler.CollectorHandler;
|
|||
import org.dromara.dynamictp.core.notifier.manager.AlarmManager;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import lombok.val;
|
||||
import org.dromara.dynamictp.spring.ex.ApplicationContextHolder;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.event.GenericApplicationListener;
|
||||
import org.springframework.core.ResolvableType;
|
||||
|
|
|
@ -24,8 +24,8 @@ import lombok.val;
|
|||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.dromara.dynamictp.adapter.common.AbstractDtpAdapter;
|
||||
import org.dromara.dynamictp.common.properties.DtpProperties;
|
||||
import org.dromara.dynamictp.common.spring.ApplicationContextHolder;
|
||||
import org.dromara.dynamictp.jvmti.JVMTI;
|
||||
import org.dromara.dynamictp.spring.ex.ApplicationContextHolder;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
|
|
@ -33,10 +33,10 @@ import org.apache.dubbo.remoting.transport.dispatcher.WrappedChannelHandler;
|
|||
import org.apache.dubbo.rpc.model.ApplicationModel;
|
||||
import org.dromara.dynamictp.adapter.common.AbstractDtpAdapter;
|
||||
import org.dromara.dynamictp.common.properties.DtpProperties;
|
||||
import org.dromara.dynamictp.common.spring.ApplicationContextHolder;
|
||||
import org.dromara.dynamictp.common.util.ReflectionUtil;
|
||||
import org.dromara.dynamictp.core.support.ThreadPoolExecutorProxy;
|
||||
import org.dromara.dynamictp.jvmti.JVMTI;
|
||||
import org.dromara.dynamictp.spring.ex.ApplicationContextHolder;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
import java.util.Map;
|
||||
|
|
|
@ -25,8 +25,8 @@ import com.netflix.hystrix.strategy.properties.HystrixProperty;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import lombok.val;
|
||||
import org.dromara.dynamictp.common.entity.TpExecutorProps;
|
||||
import org.dromara.dynamictp.common.spring.ApplicationContextHolder;
|
||||
import org.dromara.dynamictp.common.util.ReflectionUtil;
|
||||
import org.dromara.dynamictp.spring.ex.ApplicationContextHolder;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
|
|
@ -31,9 +31,9 @@ import org.dromara.dynamictp.adapter.common.AbstractDtpAdapter;
|
|||
import org.dromara.dynamictp.common.entity.NotifyPlatform;
|
||||
import org.dromara.dynamictp.common.entity.TpExecutorProps;
|
||||
import org.dromara.dynamictp.common.properties.DtpProperties;
|
||||
import org.dromara.dynamictp.common.spring.ApplicationContextHolder;
|
||||
import org.dromara.dynamictp.common.util.StreamUtil;
|
||||
import org.dromara.dynamictp.core.support.ExecutorWrapper;
|
||||
import org.dromara.dynamictp.spring.ex.ApplicationContextHolder;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
|
@ -29,8 +29,8 @@ import org.apache.commons.collections4.CollectionUtils;
|
|||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.dromara.dynamictp.adapter.common.AbstractDtpAdapter;
|
||||
import org.dromara.dynamictp.common.properties.DtpProperties;
|
||||
import org.dromara.dynamictp.common.spring.ApplicationContextHolder;
|
||||
import org.dromara.dynamictp.common.util.ReflectionUtil;
|
||||
import org.dromara.dynamictp.spring.ex.ApplicationContextHolder;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
|
|
@ -23,7 +23,7 @@ import okhttp3.OkHttpClient;
|
|||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.dromara.dynamictp.adapter.common.AbstractDtpAdapter;
|
||||
import org.dromara.dynamictp.common.properties.DtpProperties;
|
||||
import org.dromara.dynamictp.common.spring.ApplicationContextHolder;
|
||||
import org.dromara.dynamictp.spring.ex.ApplicationContextHolder;
|
||||
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ import lombok.val;
|
|||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.dromara.dynamictp.adapter.common.AbstractDtpAdapter;
|
||||
import org.dromara.dynamictp.common.properties.DtpProperties;
|
||||
import org.dromara.dynamictp.common.spring.ApplicationContextHolder;
|
||||
import org.dromara.dynamictp.common.util.ReflectionUtil;
|
||||
import org.dromara.dynamictp.spring.ex.ApplicationContextHolder;
|
||||
import org.springframework.amqp.rabbit.connection.AbstractConnectionFactory;
|
||||
|
||||
import java.util.Objects;
|
||||
|
|
|
@ -28,8 +28,8 @@ import lombok.val;
|
|||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.dromara.dynamictp.adapter.common.AbstractDtpAdapter;
|
||||
import org.dromara.dynamictp.common.properties.DtpProperties;
|
||||
import org.dromara.dynamictp.common.spring.ApplicationContextHolder;
|
||||
import org.dromara.dynamictp.common.util.ReflectionUtil;
|
||||
import org.dromara.dynamictp.spring.ex.ApplicationContextHolder;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
package org.dromara.dynamictp.common.spring;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface BeanProvider {
|
||||
<T> T getBean(Class<T> clazz);
|
||||
<T> Map<String, T> getBeansOfType(Class<T> clazz);
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package org.dromara.dynamictp.common.spring;
|
||||
|
||||
import org.dromara.dynamictp.common.util.ExtensionServiceLoader;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class BeanProviderHelper {
|
||||
|
||||
private static BeanProvider provider;
|
||||
|
||||
static {
|
||||
provider = ExtensionServiceLoader.getFirst(BeanProvider.class);
|
||||
if (provider == null) {
|
||||
throw new IllegalStateException("No BeanProvider implementation found");
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T getBean(Class<T> clazz) {
|
||||
return provider.getBean(clazz);
|
||||
}
|
||||
|
||||
public static <T> Map<String, T> getBeansOfType(Class<T> clazz) {
|
||||
return provider.getBeansOfType(clazz);
|
||||
}
|
||||
}
|
14
core/pom.xml
14
core/pom.xml
|
@ -56,6 +56,20 @@
|
|||
<groupId>io.dropwizard.metrics</groupId>
|
||||
<artifactId>metrics-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.inject</groupId>
|
||||
<artifactId>guice</artifactId>
|
||||
<version>5.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.netflix.governator</groupId>
|
||||
<artifactId>governator</artifactId>
|
||||
<version>1.17.12</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -31,7 +31,6 @@ import org.dromara.dynamictp.common.ex.DtpException;
|
|||
import org.dromara.dynamictp.common.properties.DtpProperties;
|
||||
import org.dromara.dynamictp.common.queue.MemorySafeLinkedBlockingQueue;
|
||||
import org.dromara.dynamictp.common.queue.VariableLinkedBlockingQueue;
|
||||
import org.dromara.dynamictp.common.spring.OnceApplicationContextEventListener;
|
||||
import org.dromara.dynamictp.common.util.StreamUtil;
|
||||
import org.dromara.dynamictp.core.aware.AwareManager;
|
||||
import org.dromara.dynamictp.core.converter.ExecutorConverter;
|
||||
|
|
|
@ -27,10 +27,10 @@ import org.dromara.dynamictp.core.aware.AwareManager;
|
|||
import org.dromara.dynamictp.core.aware.TaskEnhanceAware;
|
||||
import org.dromara.dynamictp.core.notifier.manager.NotifyHelper;
|
||||
import org.dromara.dynamictp.core.reject.RejectHandlerGetter;
|
||||
import org.dromara.dynamictp.core.spring.SpringExecutor;
|
||||
import org.dromara.dynamictp.core.support.ExecutorAdapter;
|
||||
import org.dromara.dynamictp.core.support.task.wrapper.TaskWrapper;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.core.task.AsyncTaskExecutor;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
@ -54,7 +54,7 @@ import static org.dromara.dynamictp.common.constant.DynamicTpConst.TRACE_ID;
|
|||
**/
|
||||
@Slf4j
|
||||
public class DtpExecutor extends ThreadPoolExecutor
|
||||
implements SpringExecutor, TaskEnhanceAware, ExecutorAdapter<ThreadPoolExecutor> {
|
||||
implements TaskEnhanceAware, ExecutorAdapter<ThreadPoolExecutor>, AsyncTaskExecutor {
|
||||
|
||||
/**
|
||||
* The name of the thread pool.
|
||||
|
|
|
@ -22,8 +22,6 @@ import org.dromara.dynamictp.common.entity.ThreadPoolStats;
|
|||
import org.dromara.dynamictp.common.event.AlarmCheckEvent;
|
||||
import org.dromara.dynamictp.common.event.CollectEvent;
|
||||
import org.dromara.dynamictp.common.properties.DtpProperties;
|
||||
import org.dromara.dynamictp.common.spring.ApplicationContextHolder;
|
||||
import org.dromara.dynamictp.common.spring.OnceApplicationContextEventListener;
|
||||
import org.dromara.dynamictp.core.DtpRegistry;
|
||||
import org.dromara.dynamictp.core.converter.ExecutorConverter;
|
||||
import org.dromara.dynamictp.core.handler.CollectorHandler;
|
||||
|
|
|
@ -17,11 +17,11 @@
|
|||
|
||||
package org.dromara.dynamictp.core.notifier.manager;
|
||||
|
||||
import org.dromara.dynamictp.common.spring.ApplicationContextHolder;
|
||||
import org.dromara.dynamictp.common.em.NotifyTypeEnum;
|
||||
import org.dromara.dynamictp.common.pattern.filter.Filter;
|
||||
import org.dromara.dynamictp.common.pattern.filter.InvokerChain;
|
||||
import org.dromara.dynamictp.common.pattern.filter.InvokerChainFactory;
|
||||
import org.dromara.dynamictp.common.spring.BeanProviderHelper;
|
||||
import org.dromara.dynamictp.core.notifier.context.BaseNotifyCtx;
|
||||
import org.dromara.dynamictp.core.notifier.chain.filter.AlarmBaseFilter;
|
||||
import org.dromara.dynamictp.core.notifier.chain.filter.NoticeBaseFilter;
|
||||
|
@ -46,7 +46,7 @@ public class NotifyFilterBuilder {
|
|||
private NotifyFilterBuilder() { }
|
||||
|
||||
public static InvokerChain<BaseNotifyCtx> getAlarmInvokerChain() {
|
||||
val filters = ApplicationContextHolder.getBeansOfType(NotifyFilter.class);
|
||||
val filters = BeanProviderHelper.getBeansOfType(NotifyFilter.class);
|
||||
Collection<NotifyFilter> alarmFilters = Lists.newArrayList(filters.values());
|
||||
alarmFilters.add(new AlarmBaseFilter());
|
||||
alarmFilters = alarmFilters.stream()
|
||||
|
@ -57,7 +57,7 @@ public class NotifyFilterBuilder {
|
|||
}
|
||||
|
||||
public static InvokerChain<BaseNotifyCtx> getCommonInvokerChain() {
|
||||
val filters = ApplicationContextHolder.getBeansOfType(NotifyFilter.class);
|
||||
val filters = BeanProviderHelper.getBeansOfType(NotifyFilter.class);
|
||||
Collection<NotifyFilter> noticeFilters = Lists.newArrayList(filters.values());
|
||||
noticeFilters.add(new NoticeBaseFilter());
|
||||
noticeFilters = noticeFilters.stream()
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.dromara.dynamictp.common.entity.NotifyPlatform;
|
|||
import org.dromara.dynamictp.common.entity.TpExecutorProps;
|
||||
import org.dromara.dynamictp.common.properties.DtpProperties;
|
||||
import org.dromara.dynamictp.common.spring.ApplicationContextHolder;
|
||||
import org.dromara.dynamictp.common.spring.BeanProviderHelper;
|
||||
import org.dromara.dynamictp.common.util.StreamUtil;
|
||||
import org.dromara.dynamictp.core.executor.DtpExecutor;
|
||||
import org.dromara.dynamictp.core.support.ExecutorWrapper;
|
||||
|
@ -136,7 +137,7 @@ public class NotifyHelper {
|
|||
}
|
||||
|
||||
public static Map<String, NotifyPlatform> getAllPlatforms() {
|
||||
val dtpProperties = ApplicationContextHolder.getBean(DtpProperties.class);
|
||||
val dtpProperties = BeanProviderHelper.getBean(DtpProperties.class);
|
||||
if (CollectionUtils.isEmpty(dtpProperties.getPlatforms())) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
@ -144,7 +145,7 @@ public class NotifyHelper {
|
|||
}
|
||||
|
||||
public static void initNotify(DtpExecutor executor) {
|
||||
val dtpProperties = ApplicationContextHolder.getBean(DtpProperties.class);
|
||||
val dtpProperties = BeanProviderHelper.getBean(DtpProperties.class);
|
||||
val platforms = dtpProperties.getPlatforms();
|
||||
if (CollectionUtils.isEmpty(platforms)) {
|
||||
executor.setNotifyItems(Lists.newArrayList());
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import org.dromara.dynamictp.common.em.ConfigFileTypeEnum;
|
||||
import org.dromara.dynamictp.common.event.RefreshEvent;
|
||||
import org.dromara.dynamictp.common.properties.DtpProperties;
|
||||
import org.dromara.dynamictp.common.spring.ApplicationContextHolder;
|
||||
import org.dromara.dynamictp.core.DtpRegistry;
|
||||
import org.dromara.dynamictp.core.handler.ConfigHandler;
|
||||
import org.dromara.dynamictp.core.support.BinderHelper;
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.dromara.dynamictp.core.notifier.manager.AlarmManager;
|
|||
import org.dromara.dynamictp.core.notifier.manager.NoticeManager;
|
||||
import org.dromara.dynamictp.core.support.DtpLifecycleSupport;
|
||||
import org.dromara.dynamictp.core.system.SystemMetricManager;
|
||||
import org.springframework.context.SmartLifecycle;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
package org.dromara.dynamictp.core.spring;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Module;
|
||||
import com.google.inject.Key;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* GuiceContextHolder
|
||||
*
|
||||
* Provides similar functionality to Spring's ApplicationContextHolder using Google Guice.
|
||||
*/
|
||||
public class GuiceContextHolder {
|
||||
|
||||
private static Injector injector;
|
||||
|
||||
private GuiceContextHolder() {
|
||||
// Private constructor to prevent instantiation
|
||||
}
|
||||
|
||||
public static void setInjector(Module... modules) {
|
||||
if (injector == null) {
|
||||
synchronized (GuiceContextHolder.class) {
|
||||
if (injector == null) {
|
||||
injector = Guice.createInjector(modules);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T getBean(Class<T> clazz) {
|
||||
return getInstance().getInstance(clazz);
|
||||
}
|
||||
|
||||
public static <T> T getBean(Key<T> key) {
|
||||
return getInstance().getInstance(key);
|
||||
}
|
||||
|
||||
public static <T> Map<Key<?>, T> getBeansOfType(Class<T> clazz) {
|
||||
return getInstance().getAllBindings().entrySet().stream()
|
||||
.filter(entry -> clazz.isAssignableFrom(entry.getKey().getTypeLiteral().getRawType()))
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, entry -> (T) entry.getValue().getProvider().get()));
|
||||
}
|
||||
|
||||
private static Injector getInstance() {
|
||||
if (injector == null) {
|
||||
throw new IllegalStateException("Injector is not initialized. Please set the injector before using it.");
|
||||
}
|
||||
return injector;
|
||||
}
|
||||
}
|
||||
|
|
@ -51,7 +51,7 @@ public class BinderHelper {
|
|||
Singleton.INST.single(PropertiesBinder.class, loadedFirstBinder);
|
||||
return loadedFirstBinder;
|
||||
}
|
||||
|
||||
|
||||
public static void bindDtpProperties(Map<?, Object> properties, DtpProperties dtpProperties) {
|
||||
final PropertiesBinder binder = getBinder();
|
||||
if (Objects.isNull(binder)) {
|
||||
|
@ -59,7 +59,7 @@ public class BinderHelper {
|
|||
}
|
||||
binder.bindDtpProperties(properties, dtpProperties);
|
||||
}
|
||||
|
||||
|
||||
public static void bindDtpProperties(Environment environment, DtpProperties dtpProperties) {
|
||||
final PropertiesBinder binder = getBinder();
|
||||
if (Objects.isNull(binder)) {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
package org.dromara.dynamictp.core.support;
|
||||
|
||||
import lombok.val;
|
||||
import org.dromara.dynamictp.common.spring.ApplicationContextHolder;
|
||||
import org.dromara.dynamictp.common.spring.BeanProviderHelper;
|
||||
import org.dromara.dynamictp.common.timer.HashedWheelTimer;
|
||||
import org.dromara.dynamictp.common.timer.Timeout;
|
||||
import org.dromara.dynamictp.core.executor.DtpExecutor;
|
||||
|
@ -164,7 +164,7 @@ public class ThreadPoolStatProvider {
|
|||
if (queueTimeout <= 0) {
|
||||
return;
|
||||
}
|
||||
HashedWheelTimer timer = ApplicationContextHolder.getBean(HashedWheelTimer.class);
|
||||
HashedWheelTimer timer = BeanProviderHelper.getBean(HashedWheelTimer.class);
|
||||
QueueTimeoutTimerTask timerTask = new QueueTimeoutTimerTask(executorWrapper, r);
|
||||
queueTimeoutMap.put(r, new SoftReference<>(timer.newTimeout(timerTask, queueTimeout, TimeUnit.MILLISECONDS)));
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ public class ThreadPoolStatProvider {
|
|||
if (runTimeout <= 0) {
|
||||
return;
|
||||
}
|
||||
HashedWheelTimer timer = ApplicationContextHolder.getBean(HashedWheelTimer.class);
|
||||
HashedWheelTimer timer = BeanProviderHelper.getBean(HashedWheelTimer.class);
|
||||
RunTimeoutTimerTask timerTask = new RunTimeoutTimerTask(executorWrapper, r, t);
|
||||
runTimeoutMap.put(r, new SoftReference<>(timer.newTimeout(timerTask, runTimeout, TimeUnit.MILLISECONDS)));
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
package org.dromara.dynamictp.example;
|
||||
|
||||
import com.baidu.cloud.starlight.springcloud.server.annotation.StarlightScan;
|
||||
import org.dromara.dynamictp.core.spring.EnableDynamicTp;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
|
@ -26,7 +25,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
* @author fabian4
|
||||
*/
|
||||
@StarlightScan
|
||||
@EnableDynamicTp
|
||||
@SpringBootApplication
|
||||
public class BrpcExampleApplication {
|
||||
public static void main(String[] args) {
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
package org.dromara.dynamictp.example;
|
||||
|
||||
import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||
import org.dromara.dynamictp.core.spring.EnableDynamicTp;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
|
@ -26,7 +25,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
* @author dragon-zhang
|
||||
*/
|
||||
@EnableDubbo
|
||||
@EnableDynamicTp
|
||||
@SpringBootApplication
|
||||
public class DubboExampleApplication {
|
||||
public static void main(String[] args) {
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
package org.dromara.dynamictp.example;
|
||||
|
||||
import org.dromara.dynamictp.core.spring.EnableDynamicTp;
|
||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
@ -26,7 +25,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
* @author dragon-zhang
|
||||
*/
|
||||
@EnableDubbo
|
||||
@EnableDynamicTp
|
||||
@SpringBootApplication
|
||||
public class DubboExampleApplication {
|
||||
public static void main(String[] args) {
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
package org.dromara.dynamictp.example;
|
||||
|
||||
import org.dromara.dynamictp.core.spring.EnableDynamicTp;
|
||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
@ -26,7 +25,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
* @author fabian4
|
||||
*/
|
||||
@EnableDubbo
|
||||
@EnableDynamicTp
|
||||
@SpringBootApplication
|
||||
public class DubboExampleApplication {
|
||||
public static void main(String[] args) {
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
package org.dromara.dynamictp.example;
|
||||
|
||||
import org.dromara.dynamictp.core.spring.EnableDynamicTp;
|
||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
@ -26,7 +25,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
* @author fabian4
|
||||
*/
|
||||
@EnableDubbo
|
||||
@EnableDynamicTp
|
||||
@SpringBootApplication
|
||||
public class DubboExampleApplication {
|
||||
public static void main(String[] args) {
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
package org.dromara.dynamictp.example;
|
||||
|
||||
import org.dromara.dynamictp.core.spring.EnableDynamicTp;
|
||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
@ -26,7 +25,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
* @author fabian4
|
||||
*/
|
||||
@EnableDubbo
|
||||
@EnableDynamicTp
|
||||
@SpringBootApplication
|
||||
public class DubboExampleApplication {
|
||||
public static void main(String[] args) {
|
||||
|
|
|
@ -17,14 +17,12 @@
|
|||
|
||||
package org.dromara.dynamictp.example;
|
||||
|
||||
import org.dromara.dynamictp.core.spring.EnableDynamicTp;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @author fabian4
|
||||
*/
|
||||
@EnableDynamicTp
|
||||
@SpringBootApplication
|
||||
public class GrpcExampleApplication {
|
||||
public static void main(String[] args) {
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
package org.dromara.dynamictp.example;
|
||||
|
||||
import org.dromara.dynamictp.core.spring.EnableDynamicTp;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
|
||||
|
@ -26,7 +25,6 @@ import org.springframework.cloud.netflix.hystrix.EnableHystrix;
|
|||
* @author fabian4
|
||||
*/
|
||||
@EnableHystrix
|
||||
@EnableDynamicTp
|
||||
@SpringBootApplication
|
||||
public class HystrixExampleApplication {
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
package org.dromara.dynamictp.example;
|
||||
|
||||
import org.dromara.dynamictp.core.spring.EnableDynamicTp;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.ImportResource;
|
||||
|
@ -25,7 +24,6 @@ import org.springframework.context.annotation.ImportResource;
|
|||
/**
|
||||
* @author fabian4
|
||||
*/
|
||||
@EnableDynamicTp
|
||||
@SpringBootApplication
|
||||
@ImportResource(locations = {"classpath:motan_server.xml"})
|
||||
public class MotanExampleApplication {
|
||||
|
|
|
@ -17,14 +17,12 @@
|
|||
|
||||
package org.dromara.dynamictp.example;
|
||||
|
||||
import org.dromara.dynamictp.core.spring.EnableDynamicTp;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @author fabian4
|
||||
*/
|
||||
@EnableDynamicTp
|
||||
@SpringBootApplication
|
||||
public class Okhttp3ExampleApplication {
|
||||
|
||||
|
|
|
@ -17,14 +17,12 @@
|
|||
|
||||
package org.dromara.dynamictp.example;
|
||||
|
||||
import org.dromara.dynamictp.core.spring.EnableDynamicTp;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @author fabian4
|
||||
*/
|
||||
@EnableDynamicTp
|
||||
@SpringBootApplication
|
||||
public class RabbitMqExampleApplication {
|
||||
|
||||
|
|
|
@ -17,14 +17,12 @@
|
|||
|
||||
package org.dromara.dynamictp.example;
|
||||
|
||||
import org.dromara.dynamictp.core.spring.EnableDynamicTp;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @author fabian4
|
||||
*/
|
||||
@EnableDynamicTp
|
||||
@SpringBootApplication
|
||||
public class RocketMqExampleApplication {
|
||||
|
||||
|
|
|
@ -17,14 +17,12 @@
|
|||
|
||||
package org.dromara.dynamictp.example;
|
||||
|
||||
import org.dromara.dynamictp.core.spring.EnableDynamicTp;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @author Redick01
|
||||
*/
|
||||
@EnableDynamicTp
|
||||
@SpringBootApplication
|
||||
public class ApolloExampleApplication {
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
package org.dromara.dynamictp.example;
|
||||
|
||||
import org.dromara.dynamictp.core.spring.EnableDynamicTp;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
@ -26,7 +25,6 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
|
|||
/**
|
||||
* @author Redick01
|
||||
*/
|
||||
@EnableDynamicTp
|
||||
@EnableFeignClients
|
||||
@MapperScan(basePackages = {"org.dromara.dynamictp.example.mapper"})
|
||||
@SpringBootApplication
|
||||
|
|
|
@ -17,14 +17,12 @@
|
|||
|
||||
package org.dromara.dynamictp.example;
|
||||
|
||||
import org.dromara.dynamictp.core.spring.EnableDynamicTp;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @author Redick01
|
||||
*/
|
||||
@EnableDynamicTp
|
||||
@SpringBootApplication
|
||||
public class EtcdExampleApplication {
|
||||
|
||||
|
|
|
@ -17,14 +17,12 @@
|
|||
|
||||
package org.dromara.dynamictp.example;
|
||||
|
||||
import org.dromara.dynamictp.core.spring.EnableDynamicTp;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @author windsearcher
|
||||
*/
|
||||
@EnableDynamicTp
|
||||
@SpringBootApplication
|
||||
public class HuaweiCloudExampleApplication {
|
||||
|
||||
|
|
|
@ -17,14 +17,12 @@
|
|||
|
||||
package org.dromara.dynamictp.example;
|
||||
|
||||
import org.dromara.dynamictp.core.spring.EnableDynamicTp;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @author Redick01
|
||||
*/
|
||||
@EnableDynamicTp
|
||||
@SpringBootApplication
|
||||
public class NacosCloudExampleApplication {
|
||||
|
||||
|
|
|
@ -17,14 +17,12 @@
|
|||
|
||||
package org.dromara.dynamictp.example;
|
||||
|
||||
import org.dromara.dynamictp.core.spring.EnableDynamicTp;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @author Redick01
|
||||
*/
|
||||
@EnableDynamicTp
|
||||
@SpringBootApplication
|
||||
public class NacosExampleApplication {
|
||||
|
||||
|
|
|
@ -17,14 +17,12 @@
|
|||
|
||||
package org.dromara.dynamictp.example;
|
||||
|
||||
import org.dromara.dynamictp.core.spring.EnableDynamicTp;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @author fabian4
|
||||
*/
|
||||
@EnableDynamicTp
|
||||
@SpringBootApplication
|
||||
public class PolarisCloudExampleApplication {
|
||||
|
||||
|
|
|
@ -17,14 +17,12 @@
|
|||
|
||||
package org.dromara.dynamictp.example;
|
||||
|
||||
import org.dromara.dynamictp.core.spring.EnableDynamicTp;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @author Redick01
|
||||
*/
|
||||
@EnableDynamicTp
|
||||
@SpringBootApplication
|
||||
public class CloudZookeeperExampleApplication {
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
package org.dromara.dynamictp.example;
|
||||
|
||||
import org.dromara.dynamictp.core.spring.EnableDynamicTp;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
@ -25,7 +24,6 @@ import org.springframework.scheduling.annotation.EnableAsync;
|
|||
/**
|
||||
* @author Redick01
|
||||
*/
|
||||
@EnableDynamicTp
|
||||
@EnableAsync
|
||||
@SpringBootApplication
|
||||
public class ZookeeperExampleApplication {
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
package org.dromara.dynamictp.extension.limiter.redis.ratelimiter;
|
||||
|
||||
import org.dromara.dynamictp.common.util.CommonUtil;
|
||||
import org.dromara.dynamictp.extension.limiter.redis.em.RateLimitEnum;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
|
||||
|
|
|
@ -26,8 +26,6 @@ import org.dromara.dynamictp.common.entity.AlarmInfo;
|
|||
import org.dromara.dynamictp.common.entity.NotifyItem;
|
||||
import org.dromara.dynamictp.common.entity.NotifyPlatform;
|
||||
import org.dromara.dynamictp.common.entity.TpMainFields;
|
||||
import org.dromara.dynamictp.common.spring.ApplicationContextHolder;
|
||||
import org.dromara.dynamictp.common.util.CommonUtil;
|
||||
import org.dromara.dynamictp.common.util.DateUtil;
|
||||
import org.dromara.dynamictp.core.notifier.AbstractDtpNotifier;
|
||||
import org.dromara.dynamictp.core.notifier.alarm.AlarmCounter;
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.dromara.dynamictp.extension.notify.yunzhijia;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.dromara.dynamictp.common.spring.ApplicationContextHolder;
|
||||
import org.dromara.dynamictp.core.notifier.AbstractDtpNotifier;
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
package org.dromara.dynamictp.logging;
|
||||
|
||||
import org.dromara.dynamictp.common.spring.ApplicationContextHolder;
|
||||
import org.dromara.dynamictp.common.properties.DtpProperties;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
|
1
pom.xml
1
pom.xml
|
@ -48,6 +48,7 @@
|
|||
<module>jvmti</module>
|
||||
<module>test</module>
|
||||
<module>dependencies</module>
|
||||
<module>spring</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.dromara.dynamictp</groupId>
|
||||
<artifactId>dynamic-tp-all</artifactId>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
<artifactId>dynamic-tp-spring</artifactId>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.dynamictp</groupId>
|
||||
<artifactId>dynamic-tp-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -15,7 +15,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.dynamictp.common.spring;
|
||||
package org.dromara.dynamictp.spring.ex;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
|
@ -15,11 +15,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.dynamictp.core.spring;
|
||||
package org.dromara.dynamictp.spring.ex;
|
||||
|
||||
import org.dromara.dynamictp.common.properties.DtpProperties;
|
||||
import org.dromara.dynamictp.core.DtpRegistry;
|
||||
import org.dromara.dynamictp.core.monitor.DtpMonitor;
|
||||
import org.dromara.dynamictp.core.spring.DtpLifecycle;
|
||||
import org.dromara.dynamictp.core.support.DtpBannerPrinter;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Bean;
|
|
@ -15,11 +15,10 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.dynamictp.core.spring;
|
||||
package org.dromara.dynamictp.spring.ex;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import org.dromara.dynamictp.common.spring.ApplicationContextHolder;
|
||||
import org.dromara.dynamictp.common.spring.SpringBeanHelper;
|
||||
|
||||
import org.dromara.dynamictp.common.timer.HashedWheelTimer;
|
||||
import org.dromara.dynamictp.core.executor.NamedThreadFactory;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
|
@ -15,7 +15,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.dynamictp.core.spring;
|
||||
package org.dromara.dynamictp.spring.ex;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
@ -23,7 +23,6 @@ import lombok.val;
|
|||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.dromara.dynamictp.common.entity.DtpExecutorProps;
|
||||
import org.dromara.dynamictp.common.properties.DtpProperties;
|
||||
import org.dromara.dynamictp.common.spring.SpringBeanHelper;
|
||||
import org.dromara.dynamictp.core.executor.ExecutorType;
|
||||
import org.dromara.dynamictp.core.executor.NamedThreadFactory;
|
||||
import org.dromara.dynamictp.core.executor.eager.EagerDtpExecutor;
|
||||
|
@ -42,23 +41,7 @@ import java.util.Map;
|
|||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.PriorityBlockingQueue;
|
||||
|
||||
import static org.dromara.dynamictp.common.constant.DynamicTpConst.ALLOW_CORE_THREAD_TIMEOUT;
|
||||
import static org.dromara.dynamictp.common.constant.DynamicTpConst.AWAIT_TERMINATION_SECONDS;
|
||||
import static org.dromara.dynamictp.common.constant.DynamicTpConst.AWARE_NAMES;
|
||||
import static org.dromara.dynamictp.common.constant.DynamicTpConst.NOTIFY_ENABLED;
|
||||
import static org.dromara.dynamictp.common.constant.DynamicTpConst.NOTIFY_ITEMS;
|
||||
import static org.dromara.dynamictp.common.constant.DynamicTpConst.PLATFORM_IDS;
|
||||
import static org.dromara.dynamictp.common.constant.DynamicTpConst.PLUGIN_NAMES;
|
||||
import static org.dromara.dynamictp.common.constant.DynamicTpConst.PRE_START_ALL_CORE_THREADS;
|
||||
import static org.dromara.dynamictp.common.constant.DynamicTpConst.QUEUE_TIMEOUT;
|
||||
import static org.dromara.dynamictp.common.constant.DynamicTpConst.REJECT_ENHANCED;
|
||||
import static org.dromara.dynamictp.common.constant.DynamicTpConst.REJECT_HANDLER_TYPE;
|
||||
import static org.dromara.dynamictp.common.constant.DynamicTpConst.RUN_TIMEOUT;
|
||||
import static org.dromara.dynamictp.common.constant.DynamicTpConst.TASK_WRAPPERS;
|
||||
import static org.dromara.dynamictp.common.constant.DynamicTpConst.THREAD_POOL_ALIAS_NAME;
|
||||
import static org.dromara.dynamictp.common.constant.DynamicTpConst.THREAD_POOL_NAME;
|
||||
import static org.dromara.dynamictp.common.constant.DynamicTpConst.TRY_INTERRUPT_WHEN_TIMEOUT;
|
||||
import static org.dromara.dynamictp.common.constant.DynamicTpConst.WAIT_FOR_TASKS_TO_COMPLETE_ON_SHUTDOWN;
|
||||
import static org.dromara.dynamictp.common.constant.DynamicTpConst.*;
|
||||
import static org.dromara.dynamictp.common.em.QueueTypeEnum.buildLbq;
|
||||
import static org.dromara.dynamictp.common.entity.NotifyItem.mergeAllNotifyItems;
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.dynamictp.core.spring;
|
||||
package org.dromara.dynamictp.spring.ex;
|
||||
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.springframework.context.EnvironmentAware;
|
|
@ -1,5 +1,6 @@
|
|||
package org.dromara.dynamictp.core.spring;
|
||||
package org.dromara.dynamictp.spring.ex;
|
||||
|
||||
import org.dromara.dynamictp.core.spring.LifeCycleManagement;
|
||||
import org.springframework.context.SmartLifecycle;
|
||||
|
||||
public class DtpLifecycleSpringAdapter implements SmartLifecycle {
|
|
@ -15,7 +15,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.dynamictp.core.spring;
|
||||
package org.dromara.dynamictp.spring.ex;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.extern.slf4j.Slf4j;
|
|
@ -15,15 +15,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.dynamictp.core.spring;
|
||||
package org.dromara.dynamictp.spring.ex;
|
||||
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* EnableDynamicTp related
|
|
@ -15,18 +15,14 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.dynamictp.common.spring;
|
||||
package org.dromara.dynamictp.spring.ex;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.event.ApplicationContextEvent;
|
||||
import org.springframework.context.event.ContextClosedEvent;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.context.event.ContextStartedEvent;
|
||||
import org.springframework.context.event.ContextStoppedEvent;
|
||||
import org.springframework.context.event.*;
|
||||
|
||||
import static org.springframework.util.ObjectUtils.nullSafeEquals;
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.dynamictp.common.spring;
|
||||
package org.dromara.dynamictp.spring.ex;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
|
@ -0,0 +1,29 @@
|
|||
package org.dromara.dynamictp.spring.ex;
|
||||
|
||||
import org.dromara.dynamictp.common.spring.BeanProvider;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class SpringBeanProvider implements BeanProvider, ApplicationContextAware {
|
||||
|
||||
private static ApplicationContext context;
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) {
|
||||
context = applicationContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getBean(Class<T> clazz) {
|
||||
return context.getBean(clazz);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Map<String, T> getBeansOfType(Class<T> clazz) {
|
||||
return context.getBeansOfType(clazz);
|
||||
}
|
||||
}
|
|
@ -15,7 +15,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.dynamictp.core.spring;
|
||||
package org.dromara.dynamictp.spring.ex;
|
||||
|
||||
import org.springframework.core.task.AsyncTaskExecutor;
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.dromara.dynamictp.core.spring;
|
||||
package org.dromara.dynamictp.spring.ex;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
|
|
@ -0,0 +1 @@
|
|||
org.dromara.dynamictp.spring.ex.SpringBeanProvider
|
|
@ -19,7 +19,6 @@ package org.dromara.dynamictp.starter.adapter.brpc.autoconfigure;
|
|||
|
||||
import org.dromara.dynamictp.apapter.brpc.client.StarlightClientDtpAdapter;
|
||||
import org.dromara.dynamictp.apapter.brpc.server.StarlightServerDtpAdapter;
|
||||
import org.dromara.dynamictp.core.spring.DtpBaseBeanConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
package org.dromara.dynamictp.starter.adapter.common.autoconfigure;
|
||||
|
||||
import org.dromara.dynamictp.adapter.common.DtpAdapterListener;
|
||||
import org.dromara.dynamictp.core.spring.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.spring.ex.DtpBaseBeanConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
package org.dromara.dynamictp.starter.adapter.dubbo.autoconfigure;
|
||||
|
||||
import org.dromara.dynamictp.adapter.dubbo.alibaba.AlibabaDubboDtpAdapter;
|
||||
import org.dromara.dynamictp.spring.ex.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.starter.adapter.dubbo.autoconfigure.condition.ConditionOnAlibabaDubboApp;
|
||||
import org.dromara.dynamictp.core.spring.DtpBaseBeanConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
package org.dromara.dynamictp.starter.adapter.dubbo.autoconfigure;
|
||||
|
||||
import org.dromara.dynamictp.adapter.dubbo.apache.ApacheDubboDtpAdapter;
|
||||
import org.dromara.dynamictp.spring.ex.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.starter.adapter.dubbo.autoconfigure.condition.ConditionOnApacheDubboApp;
|
||||
import org.dromara.dynamictp.core.spring.DtpBaseBeanConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
package org.dromara.dynamictp.starter.adapter.grpc.autoconfigure;
|
||||
|
||||
import org.dromara.dynamictp.adapter.grpc.GrpcDtpAdapter;
|
||||
import org.dromara.dynamictp.core.spring.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.spring.ex.DtpBaseBeanConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
package org.dromara.dynamictp.starter.adapter.hystrix.autoconfigure;
|
||||
|
||||
import org.dromara.dynamictp.adapter.hystrix.HystrixDtpAdapter;
|
||||
import org.dromara.dynamictp.core.spring.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.spring.ex.DtpBaseBeanConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
package org.dromara.dynamictp.starter.adapter.motan.autoconfigure;
|
||||
|
||||
import org.dromara.dynamictp.adapter.motan.MotanDtpAdapter;
|
||||
import org.dromara.dynamictp.core.spring.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.spring.ex.DtpBaseBeanConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
package org.dromara.dynamictp.starter.adapter.okhttp3.autoconfigure;
|
||||
|
||||
import org.dromara.dynamictp.adapter.okhttp3.Okhttp3DtpAdapter;
|
||||
import org.dromara.dynamictp.core.spring.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.spring.ex.DtpBaseBeanConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
package org.dromara.dynamictp.starter.adapter.rabbitmq.autoconfigure;
|
||||
|
||||
import org.dromara.dynamictp.adapter.rabbitmq.RabbitMqDtpAdapter;
|
||||
import org.dromara.dynamictp.core.spring.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.spring.ex.DtpBaseBeanConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
package org.dromara.dynamictp.starter.adapter.rocketmq.autoconfigure;
|
||||
|
||||
import org.dromara.dynamictp.adapter.rocketmq.AliyunOnsRocketMqAdapter;
|
||||
import org.dromara.dynamictp.core.spring.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.spring.ex.DtpBaseBeanConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
package org.dromara.dynamictp.starter.adapter.rocketmq.autoconfigure;
|
||||
|
||||
import org.dromara.dynamictp.adapter.rocketmq.RocketMqDtpAdapter;
|
||||
import org.dromara.dynamictp.core.spring.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.spring.ex.DtpBaseBeanConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
package org.dromara.dynamictp.starter.adapter.sofa.autoconfigure;
|
||||
|
||||
import org.dromara.dynamictp.adapter.sofa.SofaDtpAdapter;
|
||||
import org.dromara.dynamictp.core.spring.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.spring.ex.DtpBaseBeanConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
package org.dromara.dynamictp.starter.adapter.tars.autoconfigure;
|
||||
|
||||
import org.dromara.dynamictp.adapter.tars.TarsDtpAdapter;
|
||||
import org.dromara.dynamictp.core.spring.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.spring.ex.DtpBaseBeanConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.dromara.dynamictp.starter.adapter.webserver;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.dynamictp.adapter.common.AbstractDtpAdapter;
|
||||
import org.dromara.dynamictp.common.properties.DtpProperties;
|
||||
import org.dromara.dynamictp.common.spring.ApplicationContextHolder;
|
||||
import org.dromara.dynamictp.core.converter.ExecutorConverter;
|
||||
import org.springframework.boot.web.context.WebServerApplicationContext;
|
||||
import org.springframework.boot.web.context.WebServerInitializedEvent;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
package org.dromara.dynamictp.starter.adapter.webserver.autocconfigure;
|
||||
|
||||
import org.dromara.dynamictp.core.spring.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.spring.ex.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.starter.adapter.webserver.autocconfigure.condition.ConditionalOnJettyWebServer;
|
||||
import org.dromara.dynamictp.starter.adapter.webserver.autocconfigure.condition.ConditionalOnTomcatWebServer;
|
||||
import org.dromara.dynamictp.starter.adapter.webserver.autocconfigure.condition.ConditionalOnUndertowWebServer;
|
||||
|
|
|
@ -31,5 +31,11 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.dynamictp</groupId>
|
||||
<artifactId>dynamic-tp-spring</artifactId>
|
||||
<version>1.1.8-beta</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
package org.dromara.dynamictp.starter.common;
|
||||
|
||||
import org.dromara.dynamictp.core.spring.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.spring.ex.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.starter.common.monitor.DtpEndpoint;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnAvailableEndpoint;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
|
|
|
@ -21,13 +21,13 @@ import cn.hutool.core.io.FileUtil;
|
|||
import com.google.common.collect.Lists;
|
||||
import lombok.val;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.dromara.dynamictp.common.spring.ApplicationContextHolder;
|
||||
import org.dromara.dynamictp.common.entity.JvmStats;
|
||||
import org.dromara.dynamictp.common.entity.Metrics;
|
||||
import org.dromara.dynamictp.core.DtpRegistry;
|
||||
import org.dromara.dynamictp.core.converter.ExecutorConverter;
|
||||
import org.dromara.dynamictp.core.support.ExecutorWrapper;
|
||||
import org.dromara.dynamictp.core.aware.MetricsAware;
|
||||
import org.dromara.dynamictp.spring.ex.ApplicationContextHolder;
|
||||
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
|
||||
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
package org.dromara.dynamictp.starter.cloud.consul.autoconfigure;
|
||||
|
||||
import org.dromara.dynamictp.common.properties.DtpProperties;
|
||||
import org.dromara.dynamictp.core.spring.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.spring.ex.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.starter.cloud.consul.refresher.CloudConsulRefresher;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.dromara.dynamictp.starter.cloud.huawei.autoconfigure;
|
|||
|
||||
import com.huaweicloud.common.configration.bootstrap.ConfigBootstrapProperties;
|
||||
import org.dromara.dynamictp.common.properties.DtpProperties;
|
||||
import org.dromara.dynamictp.core.spring.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.spring.ex.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.starter.cloud.huawei.refresher.CloudHuaweiRefresher;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.dromara.dynamictp.starter.cloud.nacos.autoconfigure;
|
|||
import com.alibaba.cloud.nacos.NacosConfigManager;
|
||||
import com.alibaba.cloud.nacos.NacosConfigProperties;
|
||||
import org.dromara.dynamictp.common.properties.DtpProperties;
|
||||
import org.dromara.dynamictp.core.spring.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.spring.ex.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.starter.cloud.nacos.refresher.CloudNacosRefresher;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.dromara.dynamictp.starter.cloud.polaris.autoconfigure;
|
|||
|
||||
import com.tencent.cloud.polaris.config.config.PolarisConfigProperties;
|
||||
import org.dromara.dynamictp.common.properties.DtpProperties;
|
||||
import org.dromara.dynamictp.core.spring.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.spring.ex.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.starter.cloud.polaris.refresher.CloudPolarisRefresher;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
package org.dromara.dynamictp.starter.cloud.zookeeper.autoconfigure;
|
||||
|
||||
import org.dromara.dynamictp.common.properties.DtpProperties;
|
||||
import org.dromara.dynamictp.core.spring.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.spring.ex.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.starter.cloud.zookeeper.refresher.CloudZookeeperRefresher;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
package org.dromara.dynamictp.starter.apollo.autoconfigure;
|
||||
|
||||
import org.dromara.dynamictp.common.properties.DtpProperties;
|
||||
import org.dromara.dynamictp.core.spring.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.spring.ex.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.starter.apollo.refresher.ApolloRefresher;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.dromara.dynamictp.starter.etcd.autoconfigure;
|
|||
|
||||
import io.etcd.jetcd.Client;
|
||||
import org.dromara.dynamictp.common.properties.DtpProperties;
|
||||
import org.dromara.dynamictp.core.spring.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.spring.ex.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.starter.etcd.refresher.EtcdRefresher;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.dromara.dynamictp.starter.nacos.autoconfigure;
|
|||
|
||||
import org.dromara.dynamictp.common.properties.DtpProperties;
|
||||
import com.alibaba.boot.nacos.config.properties.NacosConfigProperties;
|
||||
import org.dromara.dynamictp.core.spring.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.spring.ex.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.starter.nacos.refresher.NacosRefresher;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
|
|
|
@ -27,5 +27,11 @@
|
|||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.dynamictp</groupId>
|
||||
<artifactId>dynamic-tp-spring</artifactId>
|
||||
<version>1.1.8-beta</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -18,7 +18,7 @@
|
|||
package org.dromara.dynamictp.starter.zookeeper.autoconfigure;
|
||||
|
||||
import org.dromara.dynamictp.common.properties.DtpProperties;
|
||||
import org.dromara.dynamictp.core.spring.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.spring.ex.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.starter.zookeeper.refresher.ZookeeperRefresher;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
|
|
|
@ -17,8 +17,7 @@
|
|||
|
||||
package org.dromara.dynamictp.test.configcenter;
|
||||
|
||||
import org.dromara.dynamictp.core.spring.EnableDynamicTp;
|
||||
import org.dromara.dynamictp.core.spring.YamlPropertySourceFactory;
|
||||
import org.dromara.dynamictp.spring.ex.YamlPropertySourceFactory;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
|
@ -31,7 +30,6 @@ import org.springframework.context.ConfigurableApplicationContext;
|
|||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.core.env.ConfigurableEnvironment;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
/**
|
||||
* DtpBaseTest related
|
||||
|
@ -39,7 +37,6 @@ import org.springframework.core.env.Environment;
|
|||
* @author yanhom
|
||||
* @since 1.1.7
|
||||
*/
|
||||
@EnableDynamicTp
|
||||
@EnableAutoConfiguration
|
||||
@SpringBootTest(classes = {DtpBaseTest.class})
|
||||
@PropertySource(value = "classpath:/dynamic-tp-demo-dtp-dev.yml", factory = YamlPropertySourceFactory.class)
|
||||
|
|
|
@ -18,13 +18,11 @@
|
|||
package org.dromara.dynamictp.test.core.notify;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import org.dromara.dynamictp.common.spring.ApplicationContextHolder;
|
||||
import org.dromara.dynamictp.common.em.NotifyItemEnum;
|
||||
import org.dromara.dynamictp.common.entity.NotifyItem;
|
||||
import org.dromara.dynamictp.common.entity.NotifyPlatform;
|
||||
import org.dromara.dynamictp.common.entity.ServiceInstance;
|
||||
import org.dromara.dynamictp.common.entity.TpMainFields;
|
||||
import org.dromara.dynamictp.common.util.CommonUtil;
|
||||
import org.dromara.dynamictp.core.notifier.AbstractDtpNotifier;
|
||||
import org.dromara.dynamictp.core.notifier.DtpDingNotifier;
|
||||
import org.dromara.dynamictp.common.notifier.Notifier;
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
package org.dromara.dynamictp.test.core.spring;
|
||||
|
||||
import org.dromara.dynamictp.core.spring.EnableDynamicTp;
|
||||
import org.dromara.dynamictp.core.support.DynamicTp;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
@ -34,7 +33,6 @@ import java.util.concurrent.ThreadPoolExecutor;
|
|||
* Date: 2023/4/22
|
||||
* Time: 14:27
|
||||
*/
|
||||
@EnableDynamicTp
|
||||
@Configuration
|
||||
public class Config {
|
||||
/**
|
||||
|
|
|
@ -17,14 +17,12 @@
|
|||
|
||||
package org.dromara.dynamictp.test.core.spring;
|
||||
|
||||
import org.dromara.dynamictp.common.spring.ApplicationContextHolder;
|
||||
import org.dromara.dynamictp.core.DtpRegistry;
|
||||
import org.dromara.dynamictp.core.monitor.DtpMonitor;
|
||||
import org.dromara.dynamictp.core.spring.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.core.spring.DtpPostProcessor;
|
||||
import org.dromara.dynamictp.core.spring.EnableDynamicTp;
|
||||
import org.dromara.dynamictp.core.spring.YamlPropertySourceFactory;
|
||||
import org.dromara.dynamictp.core.support.DtpBannerPrinter;
|
||||
import org.dromara.dynamictp.spring.ex.DtpBaseBeanConfiguration;
|
||||
import org.dromara.dynamictp.spring.ex.DtpPostProcessor;
|
||||
import org.dromara.dynamictp.spring.ex.YamlPropertySourceFactory;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
|
@ -44,7 +42,6 @@ import org.springframework.context.annotation.PropertySource;
|
|||
public class DtpBaseBeanConfigurationTest {
|
||||
|
||||
@SpringBootTest(classes = DtpBaseBeanConfigurationTest.class)
|
||||
@EnableDynamicTp
|
||||
public static class EnableDynamicTpAnnotationTest {
|
||||
|
||||
@Autowired
|
||||
|
|
|
@ -18,9 +18,8 @@
|
|||
package org.dromara.dynamictp.test.core.spring;
|
||||
|
||||
import org.dromara.dynamictp.core.DtpRegistry;
|
||||
import org.dromara.dynamictp.core.spring.EnableDynamicTp;
|
||||
import org.dromara.dynamictp.core.spring.YamlPropertySourceFactory;
|
||||
import org.dromara.dynamictp.core.support.ThreadPoolExecutorProxy;
|
||||
import org.dromara.dynamictp.spring.ex.YamlPropertySourceFactory;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@ -37,7 +36,6 @@ import java.util.concurrent.ThreadPoolExecutor;
|
|||
/**
|
||||
* @author <a href = "mailto:kamtohung@gmail.com">KamTo Hung</a>
|
||||
*/
|
||||
@EnableDynamicTp
|
||||
@EnableAutoConfiguration
|
||||
@PropertySource(value = "classpath:/postprocessor-dtp-dev.yml", factory = YamlPropertySourceFactory.class)
|
||||
@ComponentScan(basePackages = "org.dromara.dynamictp.test.core.spring")
|
||||
|
|
|
@ -20,8 +20,8 @@ package org.dromara.dynamictp.test.core.spring;
|
|||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import org.dromara.dynamictp.common.properties.DtpProperties;
|
||||
import org.dromara.dynamictp.core.spring.YamlPropertySourceFactory;
|
||||
import org.dromara.dynamictp.core.support.BinderHelper;
|
||||
import org.dromara.dynamictp.spring.ex.YamlPropertySourceFactory;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
|
@ -20,9 +20,8 @@ package org.dromara.dynamictp.test.core.thread;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.dynamictp.core.DtpRegistry;
|
||||
import org.dromara.dynamictp.core.notifier.manager.AlarmManager;
|
||||
import org.dromara.dynamictp.core.spring.EnableDynamicTp;
|
||||
import org.dromara.dynamictp.core.spring.YamlPropertySourceFactory;
|
||||
import org.dromara.dynamictp.core.support.ExecutorWrapper;
|
||||
import org.dromara.dynamictp.spring.ex.YamlPropertySourceFactory;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.RepeatedTest;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
@ -47,7 +46,6 @@ import static org.mockito.Mockito.mockStatic;
|
|||
* @since 1.1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@EnableDynamicTp
|
||||
@EnableAutoConfiguration
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(classes = DtpExecutorTest.class)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue