#1368 - respect FactoryBean.getObjectType contract, use context… #1371
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…classloader where appropriate
DatastoreServiceMethodInvokingFactoryBean.getObjectType
returns null if not initialized (i.e.arguments
isnull
,getArguments()
returnsObject[]
). that allowsAbstractAutowireCapableBeanFactory
to initializeDatastoreServiceMethodInvokingFactoryBean
if necessaryAbstractDatastoreInitializer
andSoftServiceLoader
use the context classloader to load data service classes. this way, autowiring data services by type works reliably with spring boot devtools restart (RestartClassLoader
)@puneetbehl primarily for review by you.
after i fixed
DatastoreServiceMethodInvokingFactoryBean.getObjectType
locally and ran the sample app, i still got aNoSuchBeanDefinitionException
although i could see the bean definition..after some fun debugging in, i saw that it was again classloader-related: 2 different instances of
interface DummyDataService
being compared byDefaultListableBeanFactory.findAutowireCandidates
/ClassUtils.isAssignable
: one byAppClassLoader
, the other one byRestartClassLoader
.do you have a suggestion how to properly unit/integration test this? i saw grails/gorm-hibernate5/examples/test-data-service but the tests do not use the restart classloader anyway, right?
thanks for taking a look.