DataSource的注册容器和初始化

示例配置

application.yml

spring:
  datasource:
    druid:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://127.0.0.1:3306/test?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
      username: root
      password: xxxx

DruidDataSourceAutoConfigure的自动配置和loadBeanDefinitionsForBeanMethod处理

在druid-spring-boot-starter.jar包META-INF/spring.factories文件目录下有个自动装配的配置,如下。

org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure

而DruidDataSourceAutoConfigure类被@Configuration注解,且内部有个@Bean修饰的方法,正是DataSource,所以会在DruidDataSourceAutoConfigure时,会调用loadBeanDefinitionsForBeanMethod将DataSource注册IOC容器。具体@Configuration源码分析可见前文,或根据下面附调用链debug

package com.alibaba.druid.spring.boot.autoconfigure;

import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties;
import com.alibaba.druid.spring.boot.autoconfigure.stat.DruidFilterConfiguration;
import com.alibaba.druid.spring.boot.autoconfigure.stat.DruidSpringAopConfiguration;
import com.alibaba.druid.spring.boot.autoconfigure.stat.DruidStatViewServletConfiguration;
import com.alibaba.druid.spring.boot.autoconfigure.stat.DruidWebStatFilterConfiguration;
import javax.sql.DataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

@Configuration
@ConditionalOnClass({DruidDataSource.class})
@AutoConfigureBefore({DataSourceAutoConfiguration.class})
@EnableConfigurationProperties({DruidStatProperties.class, DataSourceProperties.class})
@Import({DruidSpringAopConfiguration.class, DruidStatViewServletConfiguration.class, DruidWebStatFilterConfiguration.class, DruidFilterConfiguration.class})
public class DruidDataSourceAutoConfigure {
    private static final Logger LOGGER = LoggerFactory.getLogger(DruidDataSourceAutoConfigure.class);

    public DruidDataSourceAutoConfigure() {
    }

    @Bean(
        initMethod = "init"
    )
    @ConditionalOnMissingBean
    public DataSource dataSource() {
        LOGGER.info("Init DruidDataSource");
        return new DruidDataSourceWrapper();
    }
}

DataSource注册IOC容器调用链

"main@1" prio=5 tid=0x1 nid=NA runnable
  java.lang.Thread.State: RUNNABLE
	  at org.springframework.beans.factory.support.DefaultListableBeanFactory.registerBeanDefinition(DefaultListableBeanFactory.java:982)
	  at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:295)
	  at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:153)
	  at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:129)
	  at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:348)
	  at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:252)
	  at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:285)
	  at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:99)
	  at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:751)
	  at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:569)
	  - locked <0x11ac> (a java.lang.Object)
	  at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144)
	  at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767)
	  at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
	  at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426)
	  at org.springframework.boot.SpringApplication.run(SpringApplication.java:326)
	  at org.springframework.boot.SpringApplication.run(SpringApplication.java:1309)
	  at org.springframework.boot.SpringApplication.run(SpringApplication.java:1298)
	  at com.java.study.StudyApplication.main(StudyApplication.java:13)

DataSource初始化

初始化入口依然是AbstractAutowireCapableBeanFactory#initializeBean(),在前面可以看到创建DataSource的类型是DruidDataSourceWrapper.class,所以在invokeInitMethods方法中调用DruidDataSourceWrapper#afterPropertiesSet(),在此方法中set用户名密码,以及url和DriverClassName

protected void invokeInitMethods(String beanName, Object bean, @Nullable RootBeanDefinition mbd)
		throws Throwable {

	boolean isInitializingBean = (bean instanceof InitializingBean);
	if (isInitializingBean && (mbd == null || !mbd.isExternallyManagedInitMethod("afterPropertiesSet"))) {
		if (logger.isTraceEnabled()) {
			logger.trace("Invoking afterPropertiesSet() on bean with name '" + beanName + "'");
		}
		if (System.getSecurityManager() != null) {
			try {
				AccessController.doPrivileged((PrivilegedExceptionAction<Object>) () -> {
					((InitializingBean) bean).afterPropertiesSet();
					return null;
				}, getAccessControlContext());
			}
			catch (PrivilegedActionException pae) {
				throw pae.getException();
			}
		}
		else {
			((InitializingBean) bean).afterPropertiesSet();
		}
	}
}

主要在初始化时,进行初始化前的属性绑定,调用ConfigurationPropertiesBindingPostProcessor#postProcessBeforeInitialization(),后面就是属性绑定的过程

@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
	bind(ConfigurationPropertiesBean.get(this.applicationContext, bean, beanName));
	return bean;
}

username、password、url和DriverClassName便是在DruidAbstractDataSource中进行设置。

public abstract class DruidAbstractDataSource extends WrapperAdapter implements DruidAbstractDataSourceMBean, DataSource, DataSourceProxy, Serializable {
    public void setUsername(String username) {
        if (StringUtils.equals(this.username, username)) {
            return;
        }

        if (inited) {
            throw new UnsupportedOperationException();
        }

        this.username = username;
    }
    
    public void setPassword(String password) {
        if (StringUtils.equals(this.password, password)) {
            return;
        }

        if (inited) {
            LOG.info("password changed");
        }

        this.password = password;
    }
    
    public void setUrl(String jdbcUrl) {
        if (StringUtils.equals(this.jdbcUrl, jdbcUrl)) {
            return;
        }

        if (inited) {
            throw new UnsupportedOperationException();
        }

        if (jdbcUrl != null) {
            jdbcUrl = jdbcUrl.trim();
        }

        this.jdbcUrl = jdbcUrl;

        // if (jdbcUrl.startsWith(ConfigFilter.URL_PREFIX)) {
        // this.filters.add(new ConfigFilter());
        // }
    }
    
    public void setDriverClassName(String driverClass) {
        if (driverClass != null && driverClass.length() > 256) {
            throw new IllegalArgumentException("driverClassName length > 256.");
        }

        if (JdbcConstants.ORACLE_DRIVER2.equalsIgnoreCase(driverClass)) {
            driverClass = "oracle.jdbc.OracleDriver";
            LOG.warn("oracle.jdbc.driver.OracleDriver is deprecated.Having use oracle.jdbc.OracleDriver.");
        }

        if (inited) {
            if (StringUtils.equals(this.driverClass, driverClass)) {
                return;
            }
            
            throw new UnsupportedOperationException();
        }

        this.driverClass = driverClass;
    }
}

获取property

此时便要去看这些value值怎么从yaml文件中取出来进行绑定的。

先看JavaBeanBinder#bind()方法,最后set方法中value值,便是property.setValue(beanSupplier, bound);中的bound,所以继续追踪propertyBinder.bindProperty()

private <T> boolean bind(BeanSupplier<T> beanSupplier, DataObjectPropertyBinder propertyBinder,
		BeanProperty property) {
	String propertyName = property.getName();
	ResolvableType type = property.getType();
	Supplier<Object> value = property.getValue(beanSupplier);
	Annotation[] annotations = property.getAnnotations();
	Object bound = propertyBinder.bindProperty(propertyName,
			Bindable.of(type).withSuppliedValue(value).withAnnotations(annotations));
	if (bound == null) {
		return false;
	}
	if (property.isSettable()) {
		property.setValue(beanSupplier, bound);
	}
	else if (value == null || !bound.equals(value.get())) {
		throw new IllegalStateException("No setter found for property: " + property.getName());
	}
	return true;
}

然后会调用Binder#bindProperty(),再调用到Binder#bindObject()方法时,会去调用findProperty(name, context),属性值便是通过此方法查找出来的

private <T> Object bindObject(ConfigurationPropertyName name, Bindable<T> target, BindHandler handler,
		Context context, boolean allowRecursiveBinding) {
	ConfigurationProperty property = findProperty(name, context);
	if (property == null && context.depth != 0 && containsNoDescendantOf(context.getSources(), name)) {
		return null;
	}
	AggregateBinder<?> aggregateBinder = getAggregateBinder(target, context);
	if (aggregateBinder != null) {
		return bindAggregate(name, target, handler, context, aggregateBinder);
	}
	if (property != null) {
		try {
			return bindProperty(target, context, property);
		}
		catch (ConverterNotFoundException ex) {
			// We might still be able to bind it using the recursive binders
			Object instance = bindDataObject(name, target, handler, context, allowRecursiveBinding);
			if (instance != null) {
				return instance;
			}
			throw ex;
		}
	}
	return bindDataObject(name, target, handler, context, allowRecursiveBinding);
}

当source为OriginTrackedMapPropertySource时,获取yaml定义的属性

private ConfigurationProperty findProperty(ConfigurationPropertyName name, Context context) {
	if (name.isEmpty()) {
		return null;
	}
	for (ConfigurationPropertySource source : context.getSources()) {
		ConfigurationProperty property = source.getConfigurationProperty(name);
		if (property != null) {
			return property;
		}
	}
	return null;
}

property的初始化赋值

上面看到来怎么取property,但property在哪个过程开始赋值的呢?这就要去看application.yaml什么时候加载。(可参考前文《Springboot源码之application.yaml读取过程》

主要是ConfigDataEnvironmentContributors#withProcessedImports()中,传入resource和configData,然后到ofUnboundImport方法中进行绑定。

ConfigDataEnvironmentContributors withProcessedImports(ConfigDataImporter importer,
		ConfigDataActivationContext activationContext) {

	while (true) {
        ConfigDataEnvironmentContributor contributorAndChildren = contributor.withChildren(importPhase,
					asContributors(imported));
	}
}
static ConfigDataEnvironmentContributor ofUnboundImport(ConfigDataResource resource, ConfigData configData,
		int propertySourceIndex) {
	PropertySource<?> propertySource = configData.getPropertySources().get(propertySourceIndex);
	ConfigurationPropertySource configurationPropertySource = ConfigurationPropertySource.from(propertySource);
	boolean ignoreImports = configData.getOptions().contains(ConfigData.Option.IGNORE_IMPORTS);
	return new ConfigDataEnvironmentContributor(Kind.UNBOUND_IMPORT, resource, propertySource,
			configurationPropertySource, null, ignoreImports, null);
}

最后在SpringConfigurationPropertySource#from()中对mapper进行赋值。

static SpringConfigurationPropertySource from(PropertySource<?> source) {
	Assert.notNull(source, "Source must not be null");
	PropertyMapper[] mappers = getPropertyMappers(source);
	if (isFullEnumerable(source)) {
		return new SpringIterableConfigurationPropertySource((EnumerablePropertySource<?>) source, mappers);
	}
	return new SpringConfigurationPropertySource(source, mappers);
}

application.yaml的读取并存储property过程调用链:

"main@1" prio=5 tid=0x1 nid=NA runnable
  java.lang.Thread.State: RUNNABLE
	  at org.springframework.boot.context.properties.source.SpringConfigurationPropertySource.<init>(SpringConfigurationPropertySource.java:73)
	  at org.springframework.boot.context.properties.source.SpringIterableConfigurationPropertySource.<init>(SpringIterableConfigurationPropertySource.java:63)
	  at org.springframework.boot.context.properties.source.SpringConfigurationPropertySource.from(SpringConfigurationPropertySource.java:148)
	  at org.springframework.boot.context.properties.source.ConfigurationPropertySource.from(ConfigurationPropertySource.java:96)
	  at org.springframework.boot.context.config.ConfigDataEnvironmentContributor.ofUnboundImport(ConfigDataEnvironmentContributor.java:286)
	  at org.springframework.boot.context.config.ConfigDataEnvironmentContributors.lambda$asContributors$1(ConfigDataEnvironmentContributors.java:154)
	  at org.springframework.boot.context.config.ConfigDataEnvironmentContributors$$Lambda$93.855700733.accept(Unknown Source:-1)
	  at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
	  at java.util.Collections$UnmodifiableMap.forEach(Collections.java:1505)
	  at org.springframework.boot.context.config.ConfigDataEnvironmentContributors.asContributors(ConfigDataEnvironmentContributors.java:152)
	  at org.springframework.boot.context.config.ConfigDataEnvironmentContributors.withProcessedImports(ConfigDataEnvironmentContributors.java:123)
	  at org.springframework.boot.context.config.ConfigDataEnvironment.processInitial(ConfigDataEnvironment.java:230)
	  at org.springframework.boot.context.config.ConfigDataEnvironment.processAndApply(ConfigDataEnvironment.java:217)
	  at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:88)
	  at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:80)
	  at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEnvironmentPreparedEvent(EnvironmentPostProcessorApplicationListener.java:100)
	  at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEvent(EnvironmentPostProcessorApplicationListener.java:86)
	  at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:203)
	  at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:196)
	  at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:170)
	  at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:148)
	  at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:82)
	  at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:63)
	  at org.springframework.boot.SpringApplicationRunListeners$$Lambda$41.586358252.accept(Unknown Source:-1)
	  at java.util.ArrayList.forEach(ArrayList.java:1257)
	  at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117)
	  at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111)
	  at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:62)
	  at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:362)
	  at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
	  at org.springframework.boot.SpringApplication.run(SpringApplication.java:1309)
	  at org.springframework.boot.SpringApplication.run(SpringApplication.java:1298)
	  at com.java.study.StudyApplication.main(StudyApplication.java:13)

具体值填充的调用链:

"main@1" prio=5 tid=0x1 nid=NA runnable
  java.lang.Thread.State: RUNNABLE
	  at com.alibaba.druid.pool.DruidAbstractDataSource.setUsername(DruidAbstractDataSource.java:1078)
	  at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-1)
	  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	  at java.lang.reflect.Method.invoke(Method.java:498)
	  at org.springframework.boot.context.properties.bind.JavaBeanBinder$BeanProperty.setValue(JavaBeanBinder.java:354)
	  at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:98)
	  at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:80)
	  at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:56)
	  at org.springframework.boot.context.properties.bind.Binder.lambda$bindDataObject$5(Binder.java:451)
	  at org.springframework.boot.context.properties.bind.Binder$$Lambda$64.1361817590.get(Unknown Source:-1)
	  at org.springframework.boot.context.properties.bind.Binder$Context.withIncreasedDepth(Binder.java:571)
	  at org.springframework.boot.context.properties.bind.Binder$Context.withDataObject(Binder.java:557)
	  at org.springframework.boot.context.properties.bind.Binder$Context.access$300(Binder.java:512)
	  at org.springframework.boot.context.properties.bind.Binder.bindDataObject(Binder.java:449)
	  at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:390)
	  at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:319)
	  at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:308)
	  at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:238)
	  at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:225)
	  at org.springframework.boot.context.properties.ConfigurationPropertiesBinder.bind(ConfigurationPropertiesBinder.java:91)
	  at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.bind(ConfigurationPropertiesBindingPostProcessor.java:89)
	  at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:78)
	  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:429)
	  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1780)
	  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:609)
	  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531)
	  at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
	  at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$207.1251219927.getObject(Unknown Source:-1)
	  at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	  - locked <0x16ed> (a java.util.concurrent.ConcurrentHashMap)
	  at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
	  at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
	  at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
	  at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1367)
	  at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1287)
	  at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:885)
	  at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:789)
	  at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:539)
	  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336)
	  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1179)
	  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:571)
	  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531)
	  at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
	  at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$207.1251219927.getObject(Unknown Source:-1)
	  at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	  at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
	  at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
	  at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
	  at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1367)
	  at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1287)
	  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1503)
	  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1401)
	  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:608)
	  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531)
	  at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
	  at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$207.1251219927.getObject(Unknown Source:-1)
	  at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	  at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
	  at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
	  at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
	  at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1367)
	  at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1287)
	  at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640)
	  at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)
	  at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
	  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1415)
	  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:608)
	  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531)
	  at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
	  at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$207.1251219927.getObject(Unknown Source:-1)
	  at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	  at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
	  at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
	  at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
	  at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1367)
	  at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1287)
	  at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640)
	  at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)
	  at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
	  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1415)
	  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:608)
	  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531)
	  at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
	  at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$207.1251219927.getObject(Unknown Source:-1)
	  at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	  at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
	  at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
	  at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944)
	  at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:925)
	  at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:588)
	  - locked <0x165b> (a java.lang.Object)
	  at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144)
	  at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767)
	  at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
	  at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426)
	  at org.springframework.boot.SpringApplication.run(SpringApplication.java:326)
	  at org.springframework.boot.SpringApplication.run(SpringApplication.java:1309)
	  at org.springframework.boot.SpringApplication.run(SpringApplication.java:1298)
	  at com.java.study.StudyApplication.main(StudyApplication.java:13)

posted @ 2020-11-25 21:56  曹自标  阅读(1083)  评论(0编辑  收藏  举报