-
Notifications
You must be signed in to change notification settings - Fork 288
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
Default models support for Spring's Autowired #477
Conversation
@chat-eau-lumi Can you take a look and make sure the Spring code for the tests is what you had in mind? It doesn't exactly need to run (since it's not being processed by the Spring annotation processor), but it should look as close to real Spring code demonstrating both |
Pull Request Test Coverage Report for Build #533
💛 - Coveralls |
Yes, it looks good! I'm used to writing public Test() instead of public init(), but it looks like init() covers the constructor case just fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Wait a moment. Clarification: the point of making Am I misunderstanding what |
Sorry, I mistook the Autowired initializers case for the Autowired contructors case for some reason! I usually see Autowired setter methods, but you're right- in general it's used for initializer methods. |
Checking the docs, it seems that what this PR does makes sense, even if it doesn't cover all the semantics of Spring's |
…annotations of Spring test (#757) This is a small followup to #477. When you are testing Spring (Boot) applications then you are replacing controllers that are normally injected via `@Autowired` with stubs, mocks or spies from Mockito. This is done with two similar annotations: - `@MockBean` - `@SpyBean` So it would be helpful if these are ignored as well.
This adds support for spring's
@Autowired
annotation as both a way to exclude fields from initialization checking (since Spring will inject them before any methods are called), and to mark methods as initializers. See Spring's documentation and the discussion in #396This is based on the original PR #475 contributed by @chat-eau-lumi (note CLA signature in that PR). It adds fixes to test cases, particularly around importing Spring classes and the constructor usage of
@Autowired
, contributed by @lazaroclapp.