有三个处理程序将自己注册到接口注册表( Set<Interfaces>
)启动期间
下面是一个例子
@Configuration
public class CardAdapterHandler implements PaymentAdapterListener {
@Autowired
private InterfaceRegistry interfaceRegistry;
@EventListener(ApplicationStartedEvent.class)
public void init() {
interfaceRegistry.setListener(this);
}
}
二等舱
@Configuration
public class CashAdapterHandler implements PaymentAdapterListener {
@Autowired
private InterfaceRegistry interfaceRegistry;
@EventListener(ApplicationStartedEvent.class)
public void init() {
interfaceRegistry.setListener(this);
}
}
以此类推。。
Spring Boot-2.2.10.释放
既然有多个类在侦听applicationstartedevent,那么多个springbean会同时侦听applicationstartedevent吗?在应用程序启动期间是否有可能发生concurrentmodificationexception?
暂无答案!
目前还没有任何答案,快来回答吧!