Spring Tool Suite
  1. Spring Tool Suite
  2. STS-797

Importing spring context files from Maven dependencies is unstable

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • 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
        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
        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
        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
        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
        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 git@github.com: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
        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 git@github.com: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.

          People

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

            Dates

            • Created:
              Updated:
              First Response Date: