|
@@ -0,0 +1,250 @@
|
|
|
|
+package org.dbsyncer.plugin.proxy;
|
|
|
|
+
|
|
|
|
+import org.dbsyncer.common.spi.ProxyApplicationContext;
|
|
|
|
+import org.springframework.beans.BeansException;
|
|
|
|
+import org.springframework.beans.factory.BeanFactory;
|
|
|
|
+import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
|
|
|
+import org.springframework.beans.factory.ObjectProvider;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
|
+import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
|
|
|
|
+import org.springframework.context.ApplicationContext;
|
|
|
|
+import org.springframework.context.MessageSourceResolvable;
|
|
|
|
+import org.springframework.context.NoSuchMessageException;
|
|
|
|
+import org.springframework.core.ResolvableType;
|
|
|
|
+import org.springframework.core.env.Environment;
|
|
|
|
+import org.springframework.core.io.Resource;
|
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
|
+
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.lang.annotation.Annotation;
|
|
|
|
+import java.util.Locale;
|
|
|
|
+import java.util.Map;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * @author AE86
|
|
|
|
+ * @version 1.0.0
|
|
|
|
+ * @date 2022/6/30 15:14
|
|
|
|
+ */
|
|
|
|
+@Component("proxyApplicationContext")
|
|
|
|
+public class ProxyApplicationContextImpl implements ProxyApplicationContext {
|
|
|
|
+
|
|
|
|
+ @Qualifier("webApplicationContext")
|
|
|
|
+ @Autowired
|
|
|
|
+ private ApplicationContext applicationContext;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public String getId() {
|
|
|
|
+ return applicationContext.getId();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public String getApplicationName() {
|
|
|
|
+ return applicationContext.getApplicationName();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public String getDisplayName() {
|
|
|
|
+ return applicationContext.getDisplayName();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public long getStartupDate() {
|
|
|
|
+ return applicationContext.getStartupDate();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ApplicationContext getParent() {
|
|
|
|
+ return applicationContext.getParent();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public AutowireCapableBeanFactory getAutowireCapableBeanFactory() throws IllegalStateException {
|
|
|
|
+ return applicationContext.getAutowireCapableBeanFactory();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public BeanFactory getParentBeanFactory() {
|
|
|
|
+ return applicationContext.getParentBeanFactory();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean containsLocalBean(String name) {
|
|
|
|
+ return applicationContext.containsLocalBean(name);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean containsBeanDefinition(String beanName) {
|
|
|
|
+ return applicationContext.containsBeanDefinition(beanName);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public int getBeanDefinitionCount() {
|
|
|
|
+ return applicationContext.getBeanDefinitionCount();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public String[] getBeanDefinitionNames() {
|
|
|
|
+ return applicationContext.getBeanDefinitionNames();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public String[] getBeanNamesForType(ResolvableType type) {
|
|
|
|
+ return applicationContext.getBeanNamesForType(type);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public String[] getBeanNamesForType(ResolvableType type, boolean includeNonSingletons, boolean allowEagerInit) {
|
|
|
|
+ return applicationContext.getBeanNamesForType(type, includeNonSingletons, allowEagerInit);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public String[] getBeanNamesForType(Class<?> type) {
|
|
|
|
+ return applicationContext.getBeanNamesForType(type);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public String[] getBeanNamesForType(Class<?> type, boolean includeNonSingletons, boolean allowEagerInit) {
|
|
|
|
+ return applicationContext.getBeanNamesForType(type, includeNonSingletons, allowEagerInit);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public <T> Map<String, T> getBeansOfType(Class<T> type) throws BeansException {
|
|
|
|
+ return applicationContext.getBeansOfType(type);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public <T> Map<String, T> getBeansOfType(Class<T> type, boolean includeNonSingletons, boolean allowEagerInit) throws BeansException {
|
|
|
|
+ return applicationContext.getBeansOfType(type, includeNonSingletons, allowEagerInit);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public String[] getBeanNamesForAnnotation(Class<? extends Annotation> annotationType) {
|
|
|
|
+ return applicationContext.getBeanNamesForAnnotation(annotationType);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Map<String, Object> getBeansWithAnnotation(Class<? extends Annotation> annotationType) throws BeansException {
|
|
|
|
+ return applicationContext.getBeansWithAnnotation(annotationType);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType) throws NoSuchBeanDefinitionException {
|
|
|
|
+ return applicationContext.findAnnotationOnBean(beanName, annotationType);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Object getBean(String name) throws BeansException {
|
|
|
|
+ return applicationContext.getBean(name);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public <T> T getBean(String name, Class<T> requiredType) throws BeansException {
|
|
|
|
+ return applicationContext.getBean(name, requiredType);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Object getBean(String name, Object... args) throws BeansException {
|
|
|
|
+ return applicationContext.getBean(name, args);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public <T> T getBean(Class<T> requiredType) throws BeansException {
|
|
|
|
+ return applicationContext.getBean(requiredType);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public <T> T getBean(Class<T> requiredType, Object... args) throws BeansException {
|
|
|
|
+ return applicationContext.getBean(requiredType, args);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public <T> ObjectProvider<T> getBeanProvider(Class<T> requiredType) {
|
|
|
|
+ return applicationContext.getBeanProvider(requiredType);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public <T> ObjectProvider<T> getBeanProvider(ResolvableType requiredType) {
|
|
|
|
+ return applicationContext.getBeanProvider(requiredType);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean containsBean(String name) {
|
|
|
|
+ return applicationContext.containsBean(name);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean isSingleton(String name) throws NoSuchBeanDefinitionException {
|
|
|
|
+ return applicationContext.isSingleton(name);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean isPrototype(String name) throws NoSuchBeanDefinitionException {
|
|
|
|
+ return applicationContext.isPrototype(name);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean isTypeMatch(String name, ResolvableType typeToMatch) throws NoSuchBeanDefinitionException {
|
|
|
|
+ return applicationContext.isTypeMatch(name, typeToMatch);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean isTypeMatch(String name, Class<?> typeToMatch) throws NoSuchBeanDefinitionException {
|
|
|
|
+ return applicationContext.isTypeMatch(name, typeToMatch);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Class<?> getType(String name) throws NoSuchBeanDefinitionException {
|
|
|
|
+ return applicationContext.getType(name);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Class<?> getType(String name, boolean allowFactoryBeanInit) throws NoSuchBeanDefinitionException {
|
|
|
|
+ return applicationContext.getType(name, allowFactoryBeanInit);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public String[] getAliases(String name) {
|
|
|
|
+ return applicationContext.getAliases(name);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void publishEvent(Object event) {
|
|
|
|
+ applicationContext.publishEvent(event);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public String getMessage(String code, Object[] args, String defaultMessage, Locale locale) {
|
|
|
|
+ return applicationContext.getMessage(code, args, defaultMessage, locale);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public String getMessage(String code, Object[] args, Locale locale) throws NoSuchMessageException {
|
|
|
|
+ return applicationContext.getMessage(code, args, locale);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public String getMessage(MessageSourceResolvable resolvable, Locale locale) throws NoSuchMessageException {
|
|
|
|
+ return applicationContext.getMessage(resolvable, locale);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Environment getEnvironment() {
|
|
|
|
+ return applicationContext.getEnvironment();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Resource[] getResources(String locationPattern) throws IOException {
|
|
|
|
+ return applicationContext.getResources(locationPattern);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Resource getResource(String location) {
|
|
|
|
+ return applicationContext.getResource(location);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ClassLoader getClassLoader() {
|
|
|
|
+ return applicationContext.getClassLoader();
|
|
|
|
+ }
|
|
|
|
+}
|