You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is quite a normal use case for developers to have a baseBean in the production files and have an overridden one in the test files. The bean in the test file is marked with @Primary so that it takes precedence when being invoked from tests.
Now, in case of using transactionoutbox-spring, the following method
@Override
public String getName(Class<?> clazz) {
String[] beanNames = applicationContext.getBeanNamesForType(clazz);
if (beanNames.length > 1) {
throw new IllegalArgumentException(
"Type "
+ clazz.getName()
+ " exists under multiple names in the context: "
+ Arrays.toString(beanNames)
+ ". Use a unique type.");
}
if (beanNames.length == 0) {
throw new IllegalArgumentException(
"Type " + clazz.getName() + " not available in the context");
}
return beanNames[0];
}
throws errors when there are more than 2 beans for the same class.
Action Items :
Modify above mentioned class to return the bean definition for a class which has a higher precedence (marked using @Primary)
Add tests for above corner case.
The text was updated successfully, but these errors were encountered:
[Copied over from #681]
It is quite a normal use case for developers to have a baseBean in the production files and have an overridden one in the test files. The bean in the test file is marked with
@Primary
so that it takes precedence when being invoked from tests.Now, in case of using transactionoutbox-spring, the following method
throws errors when there are more than 2 beans for the same class.
Action Items :
@Primary
)The text was updated successfully, but these errors were encountered: