Spring support improvements Follow
Hello
Are any Spring support improvements planned?
I would welcome the following small improvements:
1.) When I drag and drop java class from project tree into applicationContext.xml open in editor, then a bean definition will be added. Suggested bean id will be class name with first lowercase letter.
2.) When I create a bean definition in applicationContext.xml, enter class name into but without package, IntelliJ will suggest existing classes with the same name or similar name (like in ctrl+N)
3.) When I drag and drop java class from project tree into existing bean definition in open applicationContext.xml, IntelliJ will suggest adding dependency into bean declaration as constructor param or property, including creation of property in java code or adding new constructor parameter into java class.
Please sign in to leave a comment.
Hello yaro,
Please file a JIRA issue for this (although we don't in general consider
drag & drop of classes to be an efficient form of editing source code).
You can use Ctrl-Alt-Space to complete class names in XML files including
Spring context files. Type a short class name or part of it, press Ctrl-Alt-Space,
and IDEA will replace it with a qualified name.
See #1.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
>> 1.) When I drag and drop java class from project tree into
>> applicationContext.xml open in editor, then a bean definition will be
>> added. Suggested bean id will be class name with first lowercase
>> letter.
>>
Did you try "alt-insert" in applicationContext.xml?
It's not the same thing. This is a kind of 'bean first' approach -- you create a bean definition and populate it with class name and stuff.
I would second the original poster that IDEA currently lacks any kind of 'class first' approach, where you point at class or class member and the corresponding bean structures are generated for you. Usually, I navigate to a class, and then decide that there must be a bean for it. After that I have to open the spring xml file and insert a bean definition.
Not sure about drag-and-drop, but an intention to generate a bean definition for class ('Introduce Bean') would be rather useful.
It surely would. Could you please file a JIRA issue?
Agreed. I often find myself inside a class and want to generate a bean definition for it. It would be awesome to be able to use an intention while in the class file to generate a bean definition. Let's us know when you have a JIRA created and I'll vote for it...
I do not think an intention would be very useful. I work with multiple spring context xml files and want that class to be a bean in one of them. So IntelliJ would have to show up some list of all available spring context xml files which would be confusing and not very user friendly. Additionally that bean would be added into wrong place of xml file, since people will probably organize beans according to some criteria. So such a solution through intention is likely to require similar time for developer like adding the xml manually, and not being very user friendly. It does not make much sense to spend time on such a solution.