Skip to content

Commit 318ecc5

Browse files
committed
add SharedServiceConfigurer
1 parent b0fabf8 commit 318ecc5

File tree

2 files changed

+49
-6
lines changed

2 files changed

+49
-6
lines changed

sbp-core/src/main/java/org/laxture/sbp/spring/boot/SpringBootstrap.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,7 @@ public class SpringBootstrap extends SpringApplication {
208208
"org.springframework.cloud.consul.discovery.ConsulDiscoveryClientConfiguration",
209209
"org.springframework.cloud.consul.discovery.reactive.ConsulReactiveDiscoveryClientConfiguration",
210210
"org.springframework.cloud.consul.discovery.ConsulCatalogWatchAutoConfiguration",
211-
"org.springframework.cloud.consul.support.ConsulHeartbeatAutoConfiguration",
212-
// Others
213-
"org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration",
214-
"org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration",
215-
"org.springframework.boot.autoconfigure.task.TaskSchedulingAutoConfiguration",
216-
"org.springframework.boot.autoconfigure.graphql.GraphQlAutoConfiguration",
211+
"org.springframework.cloud.consul.support.ConsulHeartbeatAutoConfiguration"
217212
};
218213

219214
public static final String[] DEFAULT_EXCLUDE_APPLICATION_LISTENERS = {
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright (C) 2019-present the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.laxture.sbp.spring.boot.configurer;
17+
18+
import org.laxture.sbp.spring.boot.IPluginConfigurer;
19+
import org.laxture.sbp.spring.boot.SpringBootstrap;
20+
import org.springframework.context.support.GenericApplicationContext;
21+
22+
/**
23+
* @author <a href="https://github.com/hank-cp">Hank CP</a>
24+
*/
25+
public class SharedServiceConfigurer implements IPluginConfigurer {
26+
27+
@Override
28+
public String[] excludeConfigurations() {
29+
return new String[] {
30+
"org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration",
31+
"org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration",
32+
"org.springframework.boot.autoconfigure.task.TaskSchedulingAutoConfiguration",
33+
"org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration",
34+
"org.springframework.boot.autoconfigure.graphql.GraphQlAutoConfiguration"
35+
};
36+
}
37+
38+
@Override
39+
public void onBootstrap(SpringBootstrap bootstrap,
40+
GenericApplicationContext pluginApplicationContext) {
41+
bootstrap.importBeanFromMainContext(pluginApplicationContext, "quartzScheduler");
42+
bootstrap.importBeanFromMainContext(pluginApplicationContext, "taskExecutorBuilder");
43+
bootstrap.importBeanFromMainContext(pluginApplicationContext, "applicationTaskExecutor");
44+
bootstrap.importBeanFromMainContext(pluginApplicationContext, "taskScheduler");
45+
bootstrap.importBeanFromMainContext(pluginApplicationContext, "taskSchedulerBuilder");
46+
bootstrap.importBeanFromMainContext(pluginApplicationContext, "jacksonObjectMapper");
47+
}
48+
}

0 commit comments

Comments
 (0)