PersistenceAnnotationBeanPostProcessor obtains default EntityManagerFactory via getBean(Class) algorithm
Issue: SPR-7549
(cherry picked from commit 6157fad)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,6 +31,7 @@ import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
|
||||
import org.springframework.beans.factory.config.DependencyDescriptor;
|
||||
import org.springframework.beans.factory.config.NamedBeanHolder;
|
||||
import org.springframework.beans.factory.support.StaticListableBeanFactory;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
@@ -366,17 +367,17 @@ class StubWebApplicationContext implements WebApplicationContext {
|
||||
|
||||
@Override
|
||||
public <T> T createBean(Class<T> beanClass) {
|
||||
return BeanUtils.instantiate(beanClass);
|
||||
return BeanUtils.instantiateClass(beanClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object createBean(Class<?> beanClass, int autowireMode, boolean dependencyCheck) {
|
||||
return BeanUtils.instantiate(beanClass);
|
||||
return BeanUtils.instantiateClass(beanClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object autowire(Class<?> beanClass, int autowireMode, boolean dependencyCheck) {
|
||||
return BeanUtils.instantiate(beanClass);
|
||||
return BeanUtils.instantiateClass(beanClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -393,12 +394,17 @@ class StubWebApplicationContext implements WebApplicationContext {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object resolveDependency(DependencyDescriptor descriptor, String beanName) {
|
||||
public <T> NamedBeanHolder<T> resolveNamedBean(Class<T> requiredType) throws BeansException {
|
||||
throw new UnsupportedOperationException("Dependency resolution not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object resolveDependency(DependencyDescriptor descriptor, String beanName,
|
||||
public Object resolveDependency(DependencyDescriptor descriptor, String requestingBeanName) {
|
||||
throw new UnsupportedOperationException("Dependency resolution not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object resolveDependency(DependencyDescriptor descriptor, String requestingBeanName,
|
||||
Set<String> autowiredBeanNames, TypeConverter typeConverter) {
|
||||
throw new UnsupportedOperationException("Dependency resolution not supported");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user