Uploaded image for project: 'Spring Tool Suite'
  1. Spring Tool Suite
  2. STS-797

Importing spring context files from Maven dependencies is unstable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 2.3.0.RELEASE
    • Fix Version/s: None
    • Component/s: MAVEN
    • Labels:
      None

      Description

      I usually have jar files deliver spring context files besides the actual Java content. When declaring the jars as dependencies using the Maven dependency resolution mechanism, I can add the context files as Config Files from the classpath. The major downside is that the jar is loaded from the file present in the local maven repository, which uses the version as a path element. This breaks the import whenever the version changes.

      It would be time-saving to be able to import these dependencies in a way which is future-proof in terms of version fixes.

        Activity

        Hide
        cdupuis Christian Dupuis added a comment -

        Robert, have you tried importing them using a <import /> element? That way STS will do any actual classpath scanning instead of adding the file to the .springBeans.

        Christian

        Show
        cdupuis Christian Dupuis added a comment - Robert, have you tried importing them using a <import /> element? That way STS will do any actual classpath scanning instead of adding the file to the .springBeans. Christian
        Hide
        rombert Robert Munteanu added a comment -

        In reply to comment #1:
        > Robert, have you tried importing them using a <import /> element? That way STS
        > will do any actual classpath scanning instead of adding the file to the
        > .springBeans.
        >
        > Christian

        My approach is the following:

        1. One master file, which imports the context files from the jars and has general configuration items;
        2. A few child files, which define specific services;
        3. The master + child files are all defined as a config set

        The imported beans are used in the child files, where the warnings are generated.

        Strangely enough, I can't get the import to work. I've enabled the import support, but the warnings are still there. I've tried creating the bean definition in the parent file, which does the importing, and the warning is present.

        It's worth noting that at this point neither the jar-imported nor the workspace-referenced files are working. This is a multi-module project FWIW.

        Show
        rombert Robert Munteanu added a comment - In reply to comment #1: > Robert, have you tried importing them using a <import /> element? That way STS > will do any actual classpath scanning instead of adding the file to the > .springBeans. > > Christian My approach is the following: One master file, which imports the context files from the jars and has general configuration items; A few child files, which define specific services; The master + child files are all defined as a config set The imported beans are used in the child files, where the warnings are generated. Strangely enough, I can't get the import to work. I've enabled the import support, but the warnings are still there. I've tried creating the bean definition in the parent file, which does the importing, and the warning is present. It's worth noting that at this point neither the jar-imported nor the workspace-referenced files are working. This is a multi-module project FWIW.
        Hide
        nealeu Neale Upstone added a comment -

        @Christian

        classpath seems to have it's limitations, but rather than where we're offered "Do you want to use M2_REPO?", perhaps we might be offered "Do you want to use classpath: ?".

        For example, check out [email protected]:nealeoc/spring-templates.git, and tell me that you can get the Spring Batch Admin contexts specified in the webapp's web.xml to be recognised. Perhaps this is a bug with the web support, as I'm not sure why I shouldn't have just had to tick the web support box and get the rest for free.

        Show
        nealeu Neale Upstone added a comment - @Christian classpath seems to have it's limitations, but rather than where we're offered "Do you want to use M2_REPO?", perhaps we might be offered "Do you want to use classpath: ?". For example, check out [email protected]:nealeoc/spring-templates.git, and tell me that you can get the Spring Batch Admin contexts specified in the webapp's web.xml to be recognised. Perhaps this is a bug with the web support, as I'm not sure why I shouldn't have just had to tick the web support box and get the rest for free.
        Hide
        mlippert Martin Lippert added a comment -

        This project has moved its issue management to GitHub Issues:
        https://github.com/spring-projects/spring-ide/issues

        Therefore we closed the majority of old issues, like this one here. If you think this issue is still valid and should be fixed or worked on, please feel free to file it as a new issue on GitHub (using the link above).

        Show
        mlippert Martin Lippert added a comment - This project has moved its issue management to GitHub Issues: https://github.com/spring-projects/spring-ide/issues Therefore we closed the majority of old issues, like this one here. If you think this issue is still valid and should be fixed or worked on, please feel free to file it as a new issue on GitHub (using the link above).

          People

          • Assignee:
            Unassigned
            Reporter:
            rombert Robert Munteanu
          • Votes:
            4 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: