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
Broken injection mechanism #32716
Comments
Thanks for getting in touch, but it feels like this is a question that would be better suited to Stack Overflow. As mentioned in the guidelines for contributing, we prefer to use the issue tracker only for bugs and enhancements. Feel free to update this issue with a link to the re-posted question (so that other people can find it) or add some more details if you feel this is a genuine bug. |
A sample that demonstrates what you've described that we can clone and run. Here's one that attempts to reproduce what you've described and it works as expected: https://github.com/snicoll-scratches/demo-32716
That pinging team members and gathering your colleagues to thumb up your issue as soon as it's created is a bit obnoxious. If you provide something that fails the way you've described using only the core spring framework, we can obviously reopen and have a look to it. |
@snicoll okay, if I'll create runnable example using Spring Boot it would be possible to move this issue to Spring Boot repository? |
@jhoeller @sbrannen take a look, please
Who can explain this behavior in Spring:
there is an abstract class
question: why in case
MyRepo
is declared as@Repository
, the framework does not initialize@Autowired
fields –protected lateinit var dsl: DslContext
, but if you change@Repository
to@Service
or@Component
, the injection works? This is strange, because@Repository
is a subtype of@Component
, just at the specification level, but it turns out not, Spring handles them differently.P.S.
I noticed it on Spring Boot 3, I haven't tested it on Spring Boot 2. Constructor injection - do not suggest
The text was updated successfully, but these errors were encountered: