0

I have a spring boot app where I am scanning for all the beans defined in spring.xml of jar files added as dependency.

@ImportResource({"classpath*:/META-INF/spring.xml"})

However I have a specific jar file (foo.jar) from which my app should NOT be scanning the spring.xml. Is there a way to specify exclusion for a specific jar file?

Punter Vicky
  • 15,954
  • 56
  • 188
  • 315

1 Answers1

0

If you are using maven than you can exclude by using exclusion tag in dependency and mentioning the group id and the artifact id that is to be excluded.

It would be something like this: -

<dependency>
  <groupId>package group id</groupId>
  <artifactId>package artifact id</artifactId>
  <version></version>
  <exclusions>
    <exclusion>
      <groupId>group id to be excluded</groupId>
      <artifactId>artifact id to be excluded</artifactId>
    </exclusion>
  </exclusions>
</dependency>
srikanth r
  • 302
  • 3
  • 20
  • Thank you, I'm using gradle. But is there a way to exclude using spring ? – Punter Vicky Dec 20 '16 at 05:15
  • Sorry I am not familiar with gradle but I could find something related to your query hope this might help you [http://stackoverflow.com/questions/21764128/how-do-i-exclude-all-instances-of-a-transitive-dependency-when-using-gradle]. – srikanth r Dec 20 '16 at 05:21