Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for creating Spring XML config files #1163

Closed
sanketcs30 opened this issue Dec 21, 2023 · 18 comments
Closed

support for creating Spring XML config files #1163

sanketcs30 opened this issue Dec 21, 2023 · 18 comments
Assignees
Labels
for: eclipse something that is specific for Eclipse for: vscode something that is specific for VSCode theme: sts3-feature-request please port this specific feature of STS3 over to the new Spring Tools 4 theme: xml-support type: enhancement

Comments

@sanketcs30
Copy link

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

@martinlippert martinlippert added theme: xml-support for: eclipse something that is specific for Eclipse for: vscode something that is specific for VSCode and removed status: waiting-for-triage labels Dec 21, 2023
@martinlippert
Copy link
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?

@sanketcs30
Copy link
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

@martinlippert
Copy link
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?

@martinlippert martinlippert added the theme: sts3-feature-request please port this specific feature of STS3 over to the new Spring Tools 4 label Dec 21, 2023
@martinlippert martinlippert changed the title Spring IDE support for STS 4 plugin for Eclipse support for creating Spring XML config files Dec 21, 2023
@martinlippert
Copy link
Member

(I updated the title if this issue accordingly)

@sanketcs30
Copy link
Author

sanketcs30 commented Dec 21, 2023

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

@nealwei2008
Copy link

nealwei2008 commented Dec 22, 2023

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 的屏幕截图

@sanketcs30
Copy link
Author

Hi @nealwei2008 @martinlippert , yes in STS 4 we get option to create spring starter project , but option is not available for spring which was available in STS 3 version , under spring folder in wizards we were able to create spring bean configuration file along with adding namespaces for different spring modules which was helpful if someone is working with XML based spring projects

Below are some of the screenshots which shows how STS 3 plugin was providing options related to spring bean configuration file

1. Creating spring bean configuration file through wizard

Spring folder in Wizard

2. Once spring bean configuration file is created , it used to give option to add namespaces

Namespaces Selection

So, these are the options that are missing in new STS 4 which I think useful if someone is working with XML based spring projects , because each time manually creating spring bean configuration file and adding namespaces is not a good option

@nealwei2008
Copy link

Thanks @sanketcs30 for your answer, I knew the options about STS 3 and I just want to fix the xml error just like the element 'beans' in STS 4 with "cvc-elt.1.a: Cannot find the declaration of element 'beans'."
As we have lots of projects having XML config files, we may have to spend some time with them before refactoring.
I have read the wiki of STS3-Migration and find a possible solution about these Spring XML files which would be found under Language Servers -> Spring Language Servers -> Spring Boot Language Server -> Spring XML Config. But question is I can't find Spring Boot Language Server.
I also find an option under the path window -> Preferences -> Spring
-> XML Config Files -> Enable Spring XML Config files support. It seems that there is nothing to be changed when I check it.
What should I do? How does the Spring XML Config work? Or is there any other methods to solve this error I mentioned above? Looking forward to your answer.
2023-12-23 22-23-36 的屏幕截图

@sanketcs30
Copy link
Author

sanketcs30 commented Dec 24, 2023

Thanks @nealwei2008 for your answer , I have gone through your mentioned steps , yes even after applying those steps like window -> Preferences -> Spring -> XML Config Files -> Enable Spring XML Config files support , I am not able to see any spring folder in the wizards , so how can we find that is my question , if anyone is having any idea regarding this then please reply , it will be helpful

And @nealwei2008 for your error , I have found some solution in the link mentioned below
https://stackoverflow.com/questions/27420395/cvc-elt-1-cannot-find-the-declaration-of-element-beans

@martinlippert
Copy link
Member

Let me provide some clarify around the Spring XML support that we have in the Spring Tools 4... :-)

Spring Tools 4 provides enhanced content-assist for Spring XML config files if you open them in an XML editor in Eclipse or VSCode, for example for Spring references or class names (to name a few). This is what you enable with the mentioned preference at Preferences -> Spring -> XML Config Files -> Enable Spring XML Config files support.

(the preference mentioned in #1163 (comment) is referring to an old structure of the preferences)

There is no wizard to create new Spring XML config files anymore in the Spring Tools 4. You would have to create a simple plain new XML file (in the same way you would create any other new file in your project). That also means that the Spring Tools 4 don't have the wizards mentioned in #1163 (comment) anymore that allow you to visually select namespaces to be included.

Since we moved the overall tooling to a new architecture, we will most likely not bring back the old wizards for creating Spring XML config files. Instead, we could think about other ways to support you with the tasks that are mentioned here:

  • easily creating new Spring XML config files that allows you to easily select namespaces to be included in the XML file (based on what is configured on the classpath of the project)
  • adding namespaces to existing Spring XML config files

Most of this would probably happen inside of the editor itself using content-assist and code actions, e.g. when you create a new XML file, it could be pre-filled with some Spring XML config file body blurb and giving you the option to select the namespaces via some content-assist actions directly in the editor. Just an initial idea, but I would like to think in this direction in case we re-introduce support for that in the Spring Tools 4.

Happy to work with you on some initial thoughts and implementations, get feedback, and work on a few incremental steps here.

@martinlippert martinlippert added this to the 4.22.0.RELEASE milestone Dec 24, 2023
@martinlippert martinlippert self-assigned this Dec 24, 2023
@nealwei2008
Copy link

Yes @martinlippert. That would be great if it can be achieved. Compared to building from scratch, there are also a considerable number of historical projects. At the same time, many newcomers learn about previous construction methods such as XML Config, which is very helpful for them to master new methods.

  • easily creating new Spring XML config files
  • adding namespaces manually or automatically
  • recognizing automatically for existing files

These are enough for me and I think they should be enough for projects that have not yet been fully upgraded but are only for temporary use.

@sanketcs30
Copy link
Author

Thanks @martinlippert @nealwei2008 for your support and brief answers. Yes , if STS 4 will include the following things , then it will be great in case of working with legacy projects with XML configuration files
1. Support for creating spring bean configuration file directly through wizard
2. Support for adding namespaces for different spring modules once spring bean configuration file is created

@martinlippert
Copy link
Member

Here is the new editor-centric support for creating Spring XML config files and adding namespaces to it. The list of namespace suggestions is not (yet) based on the exact Spring modules on the classpath of the project, but just a static list of the namespaces from the core Spring framework project.

xml-content-assist-demo.mov

Please note that the Spring framework intend to phase out XML bean definitions and in particular XML configuration namespaces (as mentioned here: spring-projects/spring-framework#24237 (comment)), so we will most likely not add a lot of additional tooling features in this space anymore. But if there is something that you are missing a lot when working with existing Spring XML config files in your existing projects, let us know and we can see on a case-by-case base what is possible to implement for future versions.

@martinlippert martinlippert removed this from the 4.22.0.RELEASE milestone Jan 18, 2024
@sanketcs30
Copy link
Author

sanketcs30 commented Feb 4, 2024

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

@martinlippert
Copy link
Member

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

@sanketcs30
Copy link
Author

sanketcs30 commented Feb 15, 2024

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

@martinlippert
Copy link
Member

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

@martinlippert
Copy link
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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: eclipse something that is specific for Eclipse for: vscode something that is specific for VSCode theme: sts3-feature-request please port this specific feature of STS3 over to the new Spring Tools 4 theme: xml-support type: enhancement
Projects
None yet
Development

No branches or pull requests

3 participants