Can I ask..something about Spring Xml code completion?

Hello. I'm Korean Student.
I'm a beginner of IntelliJ.

I just want to know How to use efficiently code completion in XML files when I make Spring Bean Tags.

For exmaple, When I use IntelliJ, I have to type many package name, again and again..and Finally I can type Class name.
But Eclipse (with STS), I just type Class name, then Content assist show classes..

Is any other convenient way for IntelliJ?

I googled many things and Spent much TIme.
I can't find it. Help me..(cry)



Attachment(s):
스크린샷 2014-07-18 오후 6.28.50.png
스크린샷 2014-07-18 오후 6.19.36.png
3 comments
Comment actions Permalink

You should not need to type the package name. You can just type the class name and use autocomplete to suggest classes.

If you invoke code completion (Ctrl+Space) on the class attribute, the suggestion window will initially show packages:

screenshot-1.png
(Click on images to see larger)

But if you invoke Code completion (Ctrl+Space) a second time, classes will show, and the list will narrow down as you type:

screenshot-2.png
So that you do not have to invoke auto complete twice, you can instead invoke the "Class Name Completion" action via Ctrl+Alt+Space right from the start.

The easiest way to create a bean definition, is to:

1) Use the Code Generation action (Alt+Insert) ans select "Spring Bean":

screenshot-3.png

This will give you the basic tag skeleton with your cursor in the class name attribute:
screenshot-4.png
2) Use code completion (Ctrl+Space) twice or Class Name Completion (Ctrl+Alt+Space) to complete the name of the class you want.
screenshot-5.png

3) Upon selecting it and hitting enter, IDEA will enter the fully qualified name. Notice the red box tells you you are still in a template completion field.
screenshot-6.png
(Note that the bean I'm selecting here is from a "hello World" like Spring application I have abd use for Spring examples.)

4) Hit enter to confirm the fully qualified name, and the cursor will move to the id attribute with suggested names:
screenshot-7.png
You can either use one of the suggested names, or enter your own. Hit Enter once you are done.
screenshot-8a.png
In this screenshot, the bean class is underlined in red because some required properties (i.e. setters annotated with the @Required annotation) have not been set.

5) You can then again use the Code Generation to set the properties. With your cursor inside the bean definition element, hit Alt+Insert and select "Properties" (Note that you can use your mouse, the arrow keys or start typing the word Properties to inline search for and select the "Properties" option):
screenshot-9.png
IDEA will show a list of all the properties in the bean.
screenshot-10.png
Select one or more of the properties you want to set and click OK. IDEA will insert all the properties tags. (As a side note, the order you select the properties by using the Ctrl Key and the mouse will be the order the <property> elements appear in the <bean> element.) For any non-primitive properties, idea will add a ref tag. For any primitive properties for which there is a bean defined that satisfies the property type, IDEA will enter a 'ref' attribute; otherwise it enters a value attribute for primitive properties. For the ref attributes, it will suggest bean names. Once you select (or type one) and hit enter, it moves to the next property.
screenshot-11.png

I hope that helps answer your questions.

0
Comment actions Permalink

Ah.. Thanks a Million.

As soon as I saw Your comment.

I did it . But I realized something wrong with my IntelliJ.

Because I can't see any generate List, class and stuff..
So, I was searching the difference about Community version and Ultimate Edition...

And Now, I think My IntelliJ is Wrong. Because My version is community....(cry)..

Anyway Thanks for Your kind comment.
I'm considering purchase Ultimate Edition.

Thanks
Your comment is very helpful and impressing.

0
Comment actions Permalink

Glad I could help. You are correct that you need the Ultimate Edition to have Spring support. Keep in mind that JetBrains does offer Academic licenses for IntelliJ IDEA Ultimate at a discount. (50% off as compared to a conventional Personal License).

0

Please sign in to leave a comment.