Book Image

Java EE 6 Cookbook for Securing, Tuning, and Extending Enterprise Applications

By : Mick Knutson
Book Image

Java EE 6 Cookbook for Securing, Tuning, and Extending Enterprise Applications

By: Mick Knutson

Overview of this book

<p>Java Platform, Enterprise Edition is a widely used platform for enterprise server programming in the Java programming language. <br /><br />This book covers exciting recipes on securing, tuning and extending enterprise applications using a Java EE 6 implementation. <br /><br />The book starts with the essential changes in Java EE 6. Then we will dive into the implementation of some of the new features of the JPA 2.0 specification, and look at implementing auditing for relational data stores. There are several additional sections that describe some of the subtle issues encountered, tips, and extension points for stating your own JPA application, or extending an existing application.<br /><br />We will then look into how we can enable security for our software system using Java EE built-in features as well as using the well-known Spring Security framework. We will then look at recipes on testing various JavaEE technologies including JPA, EJB, JSF, and Web services.<br /><br />Next we will explore various ways to extend a Java EE environment with the use of additional dynamic languages as well as frameworks. <br /><br />The book then covers recipes that touch on the issues, considerations and options related to extending enterprise development efforts into mobile application development.<br /><br />At the end of the book, we will cover managing enterprise application deployment and configuration, and recipes that will help you debug problems and enhance the performance of your applications.</p>
Table of Contents (15 chapters)
Java EE 6 Cookbook for Securing, Tuning, and Extending Enterprise Applications
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface

Weaving AspectJ advice into existing libraries


Applying AspectJ advice to classes allows logic to be indirectly applied to target classes without direct knowledge. This is especially useful when working with libraries that are not directly part of a project, yet advice still needs to be applied.

In this recipe we will cover how to add AspectJ advice to Jar libraries using compile-time weaving.

Getting ready

In order to weave AspectJ advice at compile-time, we need to introduce the AspectJ compiler to compile aspect advice into the target library. Using the aspectj-maven-plugin, we can execute this compile task during one of the Maven build lifecycle phases. We compile the source aspects during the compile phase, and then compile the test aspects during the test-compile phase.

In order to weave advice into an existing library, the library or libraries need to be added to the plugin as a <weaveDependency> as depicted in the following listing:

<plugin>
<groupId>org.codehaus.mojo...