I am convinced to convert my Spring Java field injection [@Autowired] to constructor injection (among other reasons, to facilitate mock unit testing)...
Is there a utility I can use to automatically do that Spring field to constructor injection conversion?
For example, IntelliJ IDEA has generation shortcuts for a lot of things (i.e: generate setters & getters for fields); I'm hoping there's something similar to that... This is particularly useful when it is tedious to do the conversion manually, because a class to be converted already has numerous field-injected fields.
@Autowired private
to@Autowired private final
. Then there is a error displayed saying, final fields are not initialized. If you do a autocompletion(Alt+Enter) then it asks if It wants to create a contructor, and then you can select the fields and Enter. Thats it. – Felid