Skip to content

Commit d64f8c1

Browse files
committed
Make BeanDefinitionValueResolver public
Closes gh-28029
1 parent b3ceb0f commit d64f8c1

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionValueResolver.java

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,6 +25,7 @@
2525
import java.util.Set;
2626

2727
import org.springframework.beans.BeanWrapper;
28+
import org.springframework.beans.BeanWrapperImpl;
2829
import org.springframework.beans.BeansException;
2930
import org.springframework.beans.TypeConverter;
3031
import org.springframework.beans.factory.BeanCreationException;
@@ -59,7 +60,7 @@
5960
* @since 1.2
6061
* @see AbstractAutowireCapableBeanFactory
6162
*/
62-
class BeanDefinitionValueResolver {
63+
public class BeanDefinitionValueResolver {
6364

6465
private final AbstractAutowireCapableBeanFactory beanFactory;
6566

@@ -71,7 +72,8 @@ class BeanDefinitionValueResolver {
7172

7273

7374
/**
74-
* Create a BeanDefinitionValueResolver for the given BeanFactory and BeanDefinition.
75+
* Create a BeanDefinitionValueResolver for the given BeanFactory and BeanDefinition,
76+
* using the given {@link TypeConverter}.
7577
* @param beanFactory the BeanFactory to resolve against
7678
* @param beanName the name of the bean that we work on
7779
* @param beanDefinition the BeanDefinition of the bean that we work on
@@ -86,6 +88,24 @@ public BeanDefinitionValueResolver(AbstractAutowireCapableBeanFactory beanFactor
8688
this.typeConverter = typeConverter;
8789
}
8890

91+
/**
92+
* Create a BeanDefinitionValueResolver for the given BeanFactory and BeanDefinition
93+
* using a default {@link TypeConverter}.
94+
* @param beanFactory the BeanFactory to resolve against
95+
* @param beanName the name of the bean that we work on
96+
* @param beanDefinition the BeanDefinition of the bean that we work on
97+
*/
98+
public BeanDefinitionValueResolver(AbstractAutowireCapableBeanFactory beanFactory, String beanName,
99+
BeanDefinition beanDefinition) {
100+
101+
this.beanFactory = beanFactory;
102+
this.beanName = beanName;
103+
this.beanDefinition = beanDefinition;
104+
BeanWrapper beanWrapper = new BeanWrapperImpl();
105+
beanFactory.initBeanWrapper(beanWrapper);
106+
this.typeConverter = beanWrapper;
107+
}
108+
89109

90110
/**
91111
* Given a PropertyValue, return a value, resolving any references to other

0 commit comments

Comments
 (0)