How to find Spring XML definition from Java Class

2019-09-09 03:08发布

问题:

I work on a large Spring/Struts project in Eclipse. One thing I have to do frequently is dig through the spring.xml file so that I can update the definition for the class that I am working on. It seems like there should be an easy 2 or 3 click way to go from the Java class I am in to the Spring definition.

I have SpringSource installed, but this doesn't seem to offer anything that's actually useful to me. Does anyone know if this is possible in Eclipse and how to do it?

Bonus Question: is it possible to jump from a Struts Action class to it's corresponding struts.xml definition in Eclipse?

回答1:

in your eclipse project, just add the spring nature. Right click the project and select the Spring Tools option -> Add Spring Nature. This will ensure eclipse keeps your java classes and spring context in synch.