Skip to content

support for creating Spring XML config files #1163

Closed

Description

@sanketcs30

Hi @martinlippert , I'm trying to install STS 3.9.14 plugin in Eclipse IDE , then it's giving multiple errors and I have resolved these by installing new STS 4 plugin , but the main purpose of using 3.9.14 version STS plugin is to work with spring based projects with XML configurations , there is need of using spring bean configuration file , namespaces which is not available in STS 4 plugin , so is Spring team planning for the same spring IDE support in STS 4 also , it will be really helpful as many spring based legacy projects are still going in XML and Java based configurations

Thanks

#STS 4 issue #Support for Spring IDE features @martinlippert

Activity

  1. added
    for: eclipse
    for: vscode
    and removed on Dec 21, 2023
  2. martinlippert commented on Dec 21, 2023

    @martinlippert
    Member

    Thanks @sanketcs30 for reaching out to us with this request. The STS 3.x plugins for Eclipse are no longer maintained and especially due to the continuous evolution of the underlying Eclipse platform, the old versions of the STS 3.x plugins for Eclipse don't work anymore with the latest Eclipse versions.

    We are encouraging the transition to the Spring Tools 4 for Eclipse and VSCode since a number of years now and your projects that use Spring XML configurations should still work fine with using Spring Tools 4. The piece that I would like to understand in more depth here is what exactly are you missing in the Spring Tools 4? Can you describe those features in more detail and maybe provide sample projects to illustrate those?

    There is basic support for working with Spring XML configuration files in Spring Tools 4, like content-assist for bean refs, class names, etc. So what exactly is not (yet) working, what features are you missing the most?

  3. sanketcs30 commented on Dec 21, 2023

    @sanketcs30
    Author

    Acutally STS 4 is not having options to create spring bean file , adding namespaces for different spring modules like spring core , aop , mvc , transaction which were available in STS 3 plugin

  4. martinlippert commented on Dec 21, 2023

    @martinlippert
    Member

    Let me try to summarize: Support for cresting new Spring XML configuration files with an easy way to select the Spring XML namespaces based on the libraries on the classpath of the project.

    What about adding additional Spring XML namespaces to existing Spring XML config files? Is this something you would need as well? Or do you mostly select those namespaces when creating Spring XML config files?

  5. added
    theme: sts3-feature-request
    on Dec 21, 2023
  6. changed the title [-]Spring IDE support for STS 4 plugin for Eclipse[/-] [+]support for creating Spring XML config files[/+] on Dec 21, 2023
  7. martinlippert commented on Dec 21, 2023

    @martinlippert
    Member

    (I updated the title if this issue accordingly)

  8. sanketcs30 commented on Dec 21, 2023

    @sanketcs30
    Author

    Yes @martinlippert Support for cresting new Spring XML configuration files with an easy way to select the Spring XML namespaces based on the libraries on the classpath of the project , it is not available in STS 4 , like in STS 3 plugin when we use following steps
    File --> new --> other ---> spring ---> spring beans configuration file and after clicking that configuration file option it will create spring bean configuration file , also in that file itself there will be small tabs like namespaces that is not available in sts 4

    Like the image showing namespaces tab
    Spring Modules Namespaces

    How can we get these options in STS 4 , so it will be helpful if these features of STS 3 are added in STS 4 plugin

  9. nealwei2008 commented on Dec 22, 2023

    @nealwei2008

    Thanks @sanketcs30 for reaching out to us with this request. The STS 3.x plugins for Eclipse are no longer maintained and especially due to the continuous evolution of the underlying Eclipse platform, the old versions of the STS 3.x plugins for Eclipse don't work anymore with the latest Eclipse versions.

    We are encouraging the transition to the Spring Tools 4 for Eclipse and VSCode since a number of years now and your projects that use Spring XML configurations should still work fine with using Spring Tools 4. The piece that I would like to understand in more depth here is what exactly are you missing in the Spring Tools 4? Can you describe those features in more detail and maybe provide sample projects to illustrate those?

    There is basic support for working with Spring XML configuration files in Spring Tools 4, like content-assist for bean refs, class names, etc. So what exactly is not (yet) working, what features are you missing the most?

    Hi @martinlippert , may I ask how to work with Spring XML configuration files in Spring Tools 4? I can't find this option from the pure latest version of STS4 (4-4.21.0.RELEASE) with no plugin.

    2023-12-22 17-44-50 的屏幕截图

  10. 14 remaining items

  11. added 2 commits that reference this issue on Jan 18, 2024
  12. sanketcs30 commented on Feb 4, 2024

    @sanketcs30
    Author

    Hi @martinlippert can you please mention steps for how to create that spring-config.xml file , as I'm trying to work with the STS 4.21.0 version , there is no option of creating that xml file like previously we used to create like File -> New -> Other -> Spring configuration file
    Can u please mention those steps to create spring config file and also please mention how to add static namespaces as you have mentioned in the previous post , it will be nice if you add any recordings for that
    Is support for spring config file will be available from STS 4.21.1 version , which is not available on the official site for the download
    Thanks

  13. martinlippert commented on Feb 5, 2024

    @martinlippert
    Member

    This will come as part of the 4.21.1 release, so stay tuned.

  14. sanketcs30 commented on Feb 15, 2024

    @sanketcs30
    Author

    Hi @martinlippert , as you have mentioned in last post I have installed STS 4.21.1 version and tried to create spring bean configuration file , but I was unable to find the option to add namespaces or spring XML config file skeleton option as you have mentioned in the last post , can u please help me with how to get spring XML config file skeleton option or is there any way to add that option

    Options that are showing in XML file are:-

    Spring XML Support - Copy

  15. martinlippert commented on Feb 15, 2024

    @martinlippert
    Member

    Please make sure that you have enabled the Spring XML config file support in the Settings -> Spring -> XML Config Files.

  16. martinlippert commented on Jul 18, 2024

    @martinlippert
    Member

    @batobolg This looks like a different problem (showing an error when content-assist should show up for types), so please open a separate issue for this.

    It would also be good if you could open the Error Log view and and paste the details for the error message here, so that we can get a better understanding of that is wrong here.

    It might also be useful if you could enable the logging of the language server process (Preferences -> Language Servers -> Spring Language Servers -> Logging to Console). You have to restart the IDE for this change to take effect. Once that is done, the log output from the language server process shows up in the Console view, so the content of that might be useful here as well.

    Thanks!

  17. boolivar commented on Jan 1, 2025

    @boolivar

    @martinlippert I'm really sorry for writing in closed topic but I can't get classpath XSDs to work.
    I was testing STS versions from 4.24.0 up to 4.27.0 with fresh new spring starter webmvc project.
    Spring XML Config files support is enabled.

    I can generate XML config file, but no Content Assist is available for referenced namespace, spring-context as an example:

    Screenshot_1

    If I put something from context namespace I'm getting an error:

    Screenshot_2

    If I enable external resources downloading Content Assist works but uses resources from website instead of classpath:

    Screenshot_3

    tiles-configurer is a good example of element that doesn't exist in actual schema:

    org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 11 in XML document from class path resource [spring-config.xml] is invalid
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:411) ~[spring-beans-6.2.1.jar:6.2.1]
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:347) ~[spring-beans-6.2.1.jar:6.2.1]
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:319) ~[spring-beans-6.2.1.jar:6.2.1]
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:184) ~[spring-beans-6.2.1.jar:6.2.1]
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:220) ~[spring-beans-6.2.1.jar:6.2.1]
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:191) ~[spring-beans-6.2.1.jar:6.2.1]
    	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.lambda$loadBeanDefinitionsFromImportedResources$0(ConfigurationClassBeanDefinitionReader.java:391) ~[spring-context-6.2.1.jar:6.2.1]
    	at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:986) ~[na:na]
    	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromImportedResources(ConfigurationClassBeanDefinitionReader.java:359) ~[spring-context-6.2.1.jar:6.2.1]
    	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:148) ~[spring-context-6.2.1.jar:6.2.1]
    	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:121) ~[spring-context-6.2.1.jar:6.2.1]
    	at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:430) ~[spring-context-6.2.1.jar:6.2.1]
    	at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:290) ~[spring-context-6.2.1.jar:6.2.1]
    	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:349) ~[spring-context-6.2.1.jar:6.2.1]
    	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:118) ~[spring-context-6.2.1.jar:6.2.1]
    	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:791) ~[spring-context-6.2.1.jar:6.2.1]
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:609) ~[spring-context-6.2.1.jar:6.2.1]
    	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.4.1.jar:3.4.1]
    	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752) ~[spring-boot-3.4.1.jar:3.4.1]
    	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:439) ~[spring-boot-3.4.1.jar:3.4.1]
    	at org.springframework.boot.SpringApplication.run(SpringApplication.java:318) ~[spring-boot-3.4.1.jar:3.4.1]
    	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1361) ~[spring-boot-3.4.1.jar:3.4.1]
    	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1350) ~[spring-boot-3.4.1.jar:3.4.1]
    	at com.example.demo.SpringStarterDemoApplication.main(SpringStarterDemoApplication.java:12) ~[main/:na]
    Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'mvc:tiles-configurer'.
    	at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:204) ~[na:na]
    	at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:135) ~[na:na]
    	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396) ~[na:na]
    	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327) ~[na:na]
    	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284) ~[na:na]
    	at java.xml/com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:512) ~[na:na]
    	at java.xml/com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3596) ~[na:na]
    	at java.xml/com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:2144) ~[na:na]
    	at java.xml/com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.emptyElement(XMLSchemaValidator.java:850) ~[na:na]
    	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:353) ~[na:na]
    	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2726) ~[na:na]
    	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605) ~[na:na]
    	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:114) ~[na:na]
    	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:542) ~[na:na]
    	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:889) ~[na:na]
    	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:825) ~[na:na]
    	at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) ~[na:na]
    	at java.xml/com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:247) ~[na:na]
    	at java.xml/com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:342) ~[na:na]
    	at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:77) ~[spring-beans-6.2.1.jar:6.2.1]
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:441) ~[spring-beans-6.2.1.jar:6.2.1]
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:399) ~[spring-beans-6.2.1.jar:6.2.1]
    	... 23 common frames omitted
    
  18. martinlippert commented on Jan 2, 2025

    @martinlippert
    Member

    Hey @boolivar, thanks for reporting. This is most likely related to #581. Let's see if we can find a quick workaround to deal with this until the mentioned issue is resolved.

  19. martinlippert commented on Jan 8, 2025

    @martinlippert
    Member

    I tried to find a workaround for this and here is what I found working in my case. Would be awesome if you could give this a try as well to see if that works on your side as well.

    • I enabled the 'download external resources like referenced xsd' in Preferences -> XML (Wild Web Developer)
    • I added my own catalog file in Preferences -> XML (Wild Web Developer) -> Catalogs

    This catalog file looks like this (as an example):

    <?xml version="1.0"?>
    <!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
    <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
    <system systemId="https://www.springframework.org/schema/mvc/spring-mvc.xsd" uri="jar:file:///Users/<username>/.m2/repository/org/springframework/spring-webmvc/6.1.8/spring-webmvc-6.1.8.jar!/org/springframework/web/servlet/config/spring-mvc.xsd"/>
    <system systemId="http://www.springframework.org/schema/mvc/spring-mvc.xsd" uri="jar:file:///Users/<username>/.m2/repository/org/springframework/spring-webmvc/6.1.8/spring-webmvc-6.1.8.jar!/org/springframework/web/servlet/config/spring-mvc.xsd"/>
    </catalog>
    

    The exact path for the URI in there, of course, depends on your local machine. And it points to one specific version of the spring-webmvc library and the exact path to the XSD file in that library file. But this should trigger the XML tooling to use this specific XSD to validate the XML files when they refer to this namespace.

    It is not y very nice workaround (lots of custom stuff you need to do here), but maybe it helps to work with the XML files as long as the final solution to automatically pick up the right XSD within this new XML editor is released.

  20. boolivar commented on Jan 10, 2025

    @boolivar

    @martinlippert I got this configuration working!

    At first only Content Assist started working while Validator highlighted some errors.
    I'm not sure, but it looks like it was complaining on elements in XSD that was imported from XSD I use, after IDE restart or whatever it started working.
    I'll let you know if I encounter issues that matter.

    Anyway thank you very much for your response and your time!

  21. martinlippert commented on Jan 13, 2025

    @martinlippert
    Member

    @boolivar Glad to hear you got it working. Did you use the catalog for it, as described above? Or did you figure out another way to make this work?

  22. boolivar commented on Jan 14, 2025

    @boolivar

    @martinlippert I created a catalog based on your example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

for: eclipsefor: vscodetheme: sts3-feature-requesttheme: xml-supporttype: enhancement

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions