Este contenido no está disponible en el idioma seleccionado.

5.2. Configuring the Microcontainer for AOP


Before applying the audit aspect to the HR Service, a number of JARs must be added to the extension classpath. They are in the lib sub-directory of the client-aop distribution located in the examples/User_Guide/gettingStarted/commandLineClient/target/client-aop.dir directory:

Example 5.2. Listing of the examples/User_Guide/gettingStarted/commandLineClient/target/client-aop.dir Directory

        |-- client-1.0.0.jar
        |-- jboss-beans.xml
        |-- lib
        |-- auditAspect-1.0.0.jar
        |-- concurrent-1.3.4.jar
        |-- humanResourcesService-1.0.0.jar
        |-- javassist-3.6.0.GA.jar
        |-- jboss-aop-2.0.0.beta1.jar
        |-- jboss-aop-mc-int-2.0.0.Beta6.jar
        |-- jboss-common-core-2.0.4.GA.jar
        |-- jboss-common-core-2.2.1.GA.jar
        |-- jboss-common-logging-log4j-2.0.4.GA.jar
        |-- jboss-common-logging-spi-2.0.4.GA.jar
        |-- jboss-container-2.0.0.Beta6.jar
        |-- jboss-dependency-2.0.0.Beta6.jar
        |-- jboss-kernel-2.0.0.Beta6.jar
        |-- jbossxb-2.0.0.CR4.jar
        |-- log4j-1.2.14.jar
        |-- trove-2.1.1.jar
        `-- xercesImpl-2.7.1.jar
        |-- log
        `-- auditLog-18062010-122537
        `-- run.sh
Copy to Clipboard Toggle word wrap
First, lib/auditAspect-1.0.0.jar is required to create an instance of the aspect at run-time, in order to execute the logic. Next the jar file for JBoss AOP (jboss-aop.jar), along with its dependencies javassist and trove, adds the AOP functionality. Finally, the jboss-aop-mc-int jar is required because it contains an XML schema definition that allows you to define aspects inside an XML deployment descriptor. It also contains integration code to create dependencies between normal beans and aspect beans within the Microcontainer, allowing you to add behavior during the deployment and undeployment phases.
Because you are using Maven2 to assemble the client-aop distribution, you should add these JAR files by declaring the appropriate dependencies in your pom.xml file and creating a valid assembly descriptor. A sample pom.xml snippet is shown in Example 5.3, “Example pom.xml Excerpt for AOP”. To perform your build using Ant, the procedure will be different.

Example 5.3. Example pom.xml Excerpt for AOP

<dependency>
  <groupId>org.jboss.microcontainer.examples</groupId>
  <artifactId>jboss-oap</artifactId>
  <version>2.0.0</version>
</dependency>
<dependency>
  <groupId>org.jboss.microcontainer.examples</groupId>
  <artifactId>javassist</artifactId>
  <version>3.6.0.GA</version>
</dependency>
<dependency>
  <groupId>org.jboss.microcontainer.examples</groupId>
  <artifactId>trove</artifactId>
  <version>2.1.1</version>
</dependency>
<dependency>
  <groupId>org.jboss.microcontainer.examples</groupId>
  <artifactId>jboss-aop-mc-int</artifactId>
  <version>2.0.0.Beta6</version>
</dependency>
Copy to Clipboard Toggle word wrap
Volver arriba
Red Hat logoGithubredditYoutubeTwitter

Aprender

Pruebe, compre y venda

Comunidades

Acerca de la documentación de Red Hat

Ayudamos a los usuarios de Red Hat a innovar y alcanzar sus objetivos con nuestros productos y servicios con contenido en el que pueden confiar. Explore nuestras recientes actualizaciones.

Hacer que el código abierto sea más inclusivo

Red Hat se compromete a reemplazar el lenguaje problemático en nuestro código, documentación y propiedades web. Para más detalles, consulte el Blog de Red Hat.

Acerca de Red Hat

Ofrecemos soluciones reforzadas que facilitan a las empresas trabajar en plataformas y entornos, desde el centro de datos central hasta el perímetro de la red.

Theme

© 2025 Red Hat