Fuse 6 is no longer supported
As of February 2025, Red Hat Fuse 6 is no longer supported. If you are using Fuse 6, please upgrade to Red Hat build of Apache Camel.Este conteúdo não está disponível no idioma selecionado.
5.2. Class Sharing
Private class space Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
By default, a FAB adds each Maven dependency to its private class space at run time (except for dependencies having Maven group ID
org.apache.camel
, org.apache.activemq
, or org.apache.cxf
, which are shared by default). This is a safe approach to deploying dependencies, because it reduces the risk of version inconsistencies. But it is also an expensive approach, in terms of resources, because it forces the JVM to maintain a dedicated copy of each dependency in memory, just for this FAB.
Shared class space Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
You can make a FAB more economical by opting to share some of its dependencies with other applications in the container. There are two approaches you can use:
Specify shared dependencies using provided scope Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
To share a dependency (and its transitive dependencies), declare a dependency with the
provided
scope in your project's pom.xml
file. For example:
This is analogous to the approach you would use when building a WAR with Maven, in order to avoid including libraries like the servlet API or the JSP API.
Specify shared dependencies using Manifest header Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
You can also configure class sharing by setting the
FAB-Provided-Dependency:
manifest header. For example, to share all artifacts with the org.acme.foo
Maven group ID:
FAB-Provided-Dependency: org.acme.foo:* org.apache.camel:* org.apache.cxf:* org.apache.activemq:*
FAB-Provided-Dependency: org.acme.foo:* org.apache.camel:* org.apache.cxf:* org.apache.activemq:*
For full details of how to use this approach, see the section called “Sharing dependencies” and the section called “How to set JAR manifest headers”.