Empty Spring MVC tool panel view?

Answered

I have a question about Spring MVC tool panel view in Intellij IDEA (using v13.1.3).
I found some documentation on JetBrains web site, which seem to show this view showing all URL mappings in all @RequestMapping annotated classes - see screenshot here
The problem is in all my Spring projects this tool window is always blank:
mvc.png
"Beans" view seems to be working just fine, showing the beans defined in the scope (both annotated and xml-configured):
beans.png
It seems that I have all configuration files defined in Spring facet and all, but just can't get anything in MVC panel.
How do I make it work?

11 comments
Comment actions Permalink

After creating new Spring project from scratch and experimenting a little, I think I can see the case when this is happening.
If you let IDEA autodetect contexts for Spring facet, everything seems to be working fine - you can see the list of @RequestMapping URLs in Spring-MVC panel:

facet-auto.png
However if you change anything in the autodetected context (and I do mean *anything*, change name, add/remove config file or even accept one of those "error/suggestions" on top of config file), as soon as you reload the project Spring-MVC panel view is empty. It looks like IDEA stops treating contexts as MVC contexts as soon as those are not autodetected. You can see the "globe" icon disappearing there:

facet-edited.png
I'll create the issue and attached the sample project, but this is also easily reproduceable on any New Project / Spring project

1
Comment actions Permalink

How is your Spring MVC application setup, via web.xml or via Java config? Currently, only web.xml-style configuration is supported.


0
Comment actions Permalink

It's actually web.xml

0
Comment actions Permalink

Could you please create an issue http://youtrack.jetbrains.com/issues/IDEA and attach your zipped project (you can set visibility to "idea-developers" to hide it from public). Thanks.


0
Comment actions Permalink

Thanks, but no need to create issue then.

Indeed, modifying "autodetected" context is discouraged (and disabled in 14, see http://youtrack.jetbrains.com/issue/IDEA-122196). I'll investigate more why Spring MVC toolwindow loses status on unrelated changes (name), though.

0
Comment actions Permalink

Already did, -- and saw your changes. Thanks.

0
Comment actions Permalink

It seems that the reason why name change disables web context is the way autodetetion works.

From what I can see, if the context is configured manually (has a <fileset> entry in .iml) or autodetected and then removed (has a <fileset removed=true> entry) it means that IDEA will skip this context's config files from when autodetecting. All other config files will be autodetected and added into "autodetected" context (which is virtual - there are no entries for autodetected ones in .iml).

If we're to edit any autodetected context (even for a name change) - effectively we're just re-saving it as .iml entry, exluding config files in it from further autodetection.

The problem seems is that whatever test is applied to autodetected contexts to deduce if those are MVC-related or not is not applied to configured ones.

Hope that makes sense. :)

0
Comment actions Permalink

Simple solution if you deleted autodetected context as me.. Delete your spring module in category modules or facetes, and re-create. It wil do new autodetected context. But it will be great if this mvc scan functionality works with custom context selection :)

0
Comment actions Permalink

I'm having this problem and trying to troubleshoot it, removing and recreating the module is the only way ?

I recreated my project from scratch but the spring contexts are not autodetected, so really don't know how to make this work.

0
Comment actions Permalink

As the issue may be project specific, it would help a lot if you could share any project sample and report a bug at https://youtrack.jetbrains.com/newIssue?project=IDEA .

0
Comment actions Permalink

I think my problem is related with the way Spring is configured in my application, I have other applications (with autodetected contexts) without problems.

The one with the problem is using a WebApplicationInitializer and for some reason the contexts are not autodetected.

 

0

Please sign in to leave a comment.