java - Use of Spring Assert.notnull in production code -
I have found an application that uses spring alluring and every Autowold constructor Assert.notNull () process.
How can I not see how constructor autovirings make these arguments unusable, so these arguments seem to be redundant and the code has to be confused.
I appreciate that this unit may be useful for testing where ARG is manually injected, but I think the NPE in the probe will be sufficient enough to indicate that The test has not started properly.
Before I go and the 'clean' code I thought I would just ask if I remember something? I think this is just extra prevention - a feature of the automaker's container, which is different from your code and can be disabled at any time, in this way you can clearly define the contractor's contract.
Let's say someone has disabled the autoworker on that particular class and has changed it with:
& lt; Bean id = "myBean" class = "com.my.company.BeanImpl" & gt; & Lt; Constructor-arg name = "some services" & gt; & Lt; Null / & gt; & Lt; / Creator-arg & gt; & Lt; / Bean & gt; I think this is the issue you are missing :)
Comments
Post a Comment