io.github.dddplus.runtime.registry.ContainerContext Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dddplus-plugin Show documentation
Show all versions of dddplus-plugin Show documentation
DDDplus Framework Dynamic Plugin Jar Support
/*
* Copyright DDDplus Authors.
*
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package io.github.dddplus.runtime.registry;
import io.github.dddplus.plugin.IContainerContext;
import lombok.NonNull;
import org.springframework.context.ApplicationContext;
/**
* 默认的容器上下文实现.
*
*
有些{@code Plugin}不希望Spring加载,但需要中台的资源(例如:RPC/Redis/MQ),中台输出受限的Spring容器供使用
*/
final class ContainerContext implements IContainerContext {
private final ApplicationContext containerApplicationContext;
ContainerContext(ApplicationContext containerApplicationContext) {
this.containerApplicationContext = containerApplicationContext;
}
@Override
public T getBean(@NonNull Class requiredType) throws RuntimeException {
return containerApplicationContext.getBean(requiredType);
}
@Override
public T getBean(@NonNull String name, @NonNull Class requiredType) throws RuntimeException {
return containerApplicationContext.getBean(name, requiredType);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy