Skip to content

Commit 5b63f6f

Browse files
committed
服务引擎:简化boot配置
1 parent b60c59f commit 5b63f6f

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

service/src/main/java/org/bekit/service/boot/ServiceEngineConfiguration.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,12 @@
2424
* (非spring-boot项目需手动引入本配置类完成服务引擎配置)
2525
*/
2626
@Configuration
27-
@Import(EventBusConfiguration.class)
27+
@Import({EventBusConfiguration.class, ServicesHolder.class})
2828
public class ServiceEngineConfiguration {
2929

3030
// 服务引擎
3131
@Bean
3232
public ServiceEngine serviceEngine(EventBusesHolder eventBusesHolder) {
3333
return new DefaultServiceEngine(new DefaultEventPublisher(eventBusesHolder.getEventBus(ServiceListenerType.class)));
3434
}
35-
36-
// 服务持有器
37-
@Bean
38-
public ServicesHolder servicesHolder() {
39-
return new ServicesHolder();
40-
}
4135
}

service/src/main/java/org/bekit/service/service/ServicesHolder.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import org.bekit.service.annotation.service.Service;
1212
import org.springframework.beans.factory.annotation.Autowired;
1313
import org.springframework.context.ApplicationContext;
14+
import org.springframework.stereotype.Component;
1415
import org.springframework.transaction.PlatformTransactionManager;
1516

1617
import javax.annotation.PostConstruct;
@@ -19,8 +20,9 @@
1920
import java.util.Set;
2021

2122
/**
22-
* 服务持有器(会被注册到spring容器中)
23+
* 服务持有器
2324
*/
25+
@Component
2426
public class ServicesHolder {
2527
@Autowired
2628
private ApplicationContext applicationContext;

0 commit comments

Comments
 (0)