optimize: 变更 Spring Bean 执行顺序.

pull/161/head
chen.ma 4 years ago
parent b0a3a43885
commit 4e9170ff30

@ -5,6 +5,7 @@ import io.dynamic.threadpool.starter.toolkit.thread.QueueTypeEnum;
import io.dynamic.threadpool.starter.toolkit.thread.ThreadPoolBuilder;
import io.dynamic.threadpool.starter.wrap.DynamicThreadPoolWrap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import javax.annotation.PostConstruct;
@ -34,8 +35,8 @@ public class ThreadPoolConfigAdapter extends ConfigAdapter {
.rejected(new ThreadPoolExecutor.DiscardOldestPolicy())
.build();
@Order(1025)
@PostConstruct
@Order(Ordered.LOWEST_PRECEDENCE - 2048)
public void subscribeConfig() {
Map<String, DynamicThreadPoolWrap> executorMap =
ApplicationContextHolder.getBeansOfType(DynamicThreadPoolWrap.class);

@ -16,6 +16,7 @@ import io.dynamic.threadpool.starter.toolkit.thread.RejectedTypeEnum;
import io.dynamic.threadpool.starter.toolkit.thread.ThreadPoolBuilder;
import io.dynamic.threadpool.starter.wrap.DynamicThreadPoolWrap;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import javax.annotation.PostConstruct;
@ -40,8 +41,8 @@ public class ThreadPoolRunListener {
this.properties = properties;
}
@Order(1024)
@PostConstruct
@Order(Ordered.LOWEST_PRECEDENCE - 1024)
public void run() {
DynamicThreadPoolBanner.printBanner(properties.isBanner());

Loading…
Cancel
Save