-
Notifications
You must be signed in to change notification settings - Fork 38.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AOT generated code should consider visibility of FactoryBean target type #28809
Comments
I think rather the code that identifies where the code should be generated should consider the target type for a Can you expand on the |
If you need a sample to play with, here is an example that explicitly makes package protected repositories public to cause them to generate compiling AOT code. The workaround is at the top of the branch. You should see the build failing if you check out |
My fix means that a |
@odrotbohm I think your use case is already fixed by #28812 as we're now using the target type of the |
I just upgraded to the latest snapshots of Boot and Framework and still see the bean definitions for package protected repositories be generated into the Wouldn't it make sense to rather generate the entire bean definition into the package of the actual target type (if that is package protected)? |
It does that, unless the |
So the problem is that the code doesn't handle a |
Thanks, Stéphane! Just for reference: you should be able to do the following for Restbucks to see the failure or verify a fix:
|
I've polished things up and the sample above does work now. I have a feeling it will require more rounds of update as it is a bit tricky right now. @odrotbohm going forward, please do not reopen the issue as the team may decide to fix this either as part of a polish of the existing fix, or a separate issue. |
Sure thing, sorry about the hassle. I'll give the fix a try as soon as it's made it into some binaries. |
Got the binaries, works fine now. Thanks! 🙇 |
@christophstrobl |
A
FactoryBean<T>
using a package private target typeT
leads to compile errors in the generated code when theFactoryBean
implementation is not in the same package.Given a package private repository
CustomerRepository
is located incom.example.data.mongo
, and a factoryBeanDefinition
usingMongoRepositoryFactoryBean<CustomerRepository, Object, Object>
as target results in the following code being generated in theorg.springframework.data.mongodb.repository.support
package, where theMongoRepositoryFactoryBean
is located.Visibility checks should consider the generic arguments and potentially guard/load those via reflection.
The text was updated successfully, but these errors were encountered: