Refactor to Spring

IDEA is aware that my class is referenced in Spring.
I can refactor a String out to a Constant so how about a new feature that refactors out one step further into a contructor injection argument?

5 comments

On 3/19/2010 1:45 AM, opticyclic wrote:

IDEA is aware that my class is referenced in Spring.
I can refactor a String out to a Constant so how about a new feature that refactors out one step further into a contructor injection argument?


Introduce field:
   select Initialize in constructor.

Introduce parameter.


Does IDEA handle the spring config portion of that refactoring? I don't
know, but it should.

0

I wasn't aware of that functionality. I explorered the refactor menu a bit more today and discovered a couple more interesting things.
However, as far as I can tell, although it does refactor to a class contructor it doesn't update the spring config.
A single refactor to spring option would be excellent though.

0

On 3/19/2010 5:55 PM, opticyclic wrote:

I wasn't aware of that functionality. I explorered the refactor menu a bit more today and discovered a couple more interesting things.
However, as far as I can tell, although it does refactor to a class contructor it doesn't update the spring config.
A single refactor to spring option would be excellent though.

I agree.  To me that is a bug in the refactoring code for introduce
parameter.

Hmm, actually one refactoring that would be useful is "Introduce
injected field", which would be similar to Introduce Field, but creates
getters/setters automatically and moves the value into supported IoC
container configurations.

0

There are intentions for introducing constructor and setter dependencies. But handle with care, there are still problems associated with these actions, see:

http://youtrack.jetbrains.net/issue/IDEA-22574

http://youtrack.jetbrains.net/issue/IDEA-21273

Please vote for the above to be fixed!

0

Hello Daniel,

On 3/19/2010 5:55 PM, opticyclic wrote:

>> I wasn't aware of that functionality. I explorered the refactor menu
>> a bit more today and discovered a couple more interesting things.
>>
>> However, as far as I can tell, although it does refactor to a class
>> contructor it doesn't update the spring config.
>>
>> A single refactor to spring option would be excellent though.
>>

I agree.  To me that is a bug in the refactoring code for introduce
parameter.


Please file a YouTrack issue.

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Please sign in to leave a comment.