| Sign In/My Account | View Cart |
| Article: |
Twelve Best Practices For Spring XML Configurations | |
| Subject: | Good Citizen | |
| Date: | 2006-01-26 06:36:31 | |
| From: | wireframe | |
|
I disagree that setter injection is better than constructor injection. Failing fast at startup if dependencies are not provided, is always better than failing at runtime if a developer forgot to set the dependency.
|
||
Showing messages 1 through 2 of 2.
Setter injection makes your XML more readable because you know what properties you are setting without consulting the source. But for simple cases, constructor injection can make your classes more concise and not require an init-method.