Fix early init of MapperFactoryBean#32
Conversation
|
@snicoll Thanks for your work!! p.s. |
|
Thanks for trying. It is so easy to forget what the AOT engine does for us automatically. Yeah, writing custom code means you need to know about manual hints. I'll revisit this shortly. |
|
OK so the problem now is that the type of the bean is One way to fix this would be to rework this PR so that the type exposed is Another solution would be to introduce the concept of What do you think? |
|
@snicoll Thanks for your comment! Which method would you recommend? I've tried before: after: beanDefinition.setTargetType(ResolvableType.forClassWithGenerics(beanDefinition.getBeanClass(), mapperInterface));
What should I do specifically for this? |
I don't know. Is sub-classing
Nothing, that would be done completely in Spring Native. I doubt I would have the time to work on that short term though. |
|
@snicoll Thanks for quick response!!
Probably, I think it's rare. Therefore I want to apply to first solution(using |
|
OK let me update the PR in that direction |
This commit post-processes the bean factory so that the target type produced by the factory bean is exposed. While this is not a problem with a regular runtime, AOT uses instance supplier and without a proper bound for the generic type that it produces, the only solution is to create it early.
c35d4cd to
017b973
Compare
This commit post-processes the bean factory so that the target type produced by the factory bean is exposed. While this is not a problem with a regular runtime, AOT uses instance supplier and without a proper bound for the generic type that it produces, the only solution is to create it early.
An alternative would be to change
ClassPathMapperScannerin mybatis so that it exposes the type that the factory bean produces.