Tuomas Toivonen
Tuomas Toivonen

Reputation: 23502

Java EE, how to ignore annotations in certain JAR or package

I'm using a JAR library, which contains @WebService annotated classes and other Java EE annotations. The problem is, Weblogic 12c automatically discovers these annotations and provides the services. This is not the intention, rather I would like to use the JAR only as an utility library inside other Java EE project, and ignore all Java EE related configuration from Weblogic point-of-view considering this library.

Basically the library in question is another Java EE project ruthlessly bundled inside a JAR, but modifying the library is out of question, thus I need to ignore all the Java EE stuff in that library.

So, how do I instruct weblogic to ignore all the Java EE related stuff in this specific JAR archive (or alternatively all the classes under certain package specifier) from automatic discovery and configuration?

One solution that comes in my mind is metadata-complete=true in web.xml which seems to ignore those annotations. However, I'm not sure if it ignores annotations only in JAR libraries or annotations in the project itself too.

Upvotes: 2

Views: 900

Answers (1)

Anastasios Vlasopoulos
Anastasios Vlasopoulos

Reputation: 1802

You could read about the solution of metadata-complete here. This solution actually was created in order to improve the deployment performance on large scale Java EE projects.

You should try to set metadata-complete=true in the web.xml file of the library project and then create a new jar based on this change. This is against your will to refactor the library code, nevertheless it is a minor change which would not take lot of your time.

However, I'm not sure if it ignores annotations only in JAR libraries or annotations in the project itself too.

You are right. If you make this change in your project's web.xlm file then you will affect your annotations also.

Upvotes: 1

Related Questions