AspectJ in Action, Second Edition
Enterprise AOP with Spring Applications
Ramnivas Laddad
Foreword by Rod Johnson, Creator of the Spring Framework
  • September 2009
  • ISBN 9781933988054
  • 568 pages
  • printed in black & white

Clear, concisely worded, well-organized... a pleasure to read.

Rod Johnson, Creator of the Spring Framework

To allow the creation of truly modular software, OOP has evolved into aspect-oriented programming. AspectJ is a mature AOP implementation for Java, now integrated with Spring.

AspectJ in Action, Second Edition is a fully updated, major revision of Ramnivas Laddad's best-selling first edition. It's a hands-on guide for Java developers. After introducing the core principles of AOP, it shows you how to create reusable solutions using AspectJ 6 and Spring 3. You'll master key features including annotation-based syntax, load-time weaver, annotation-based crosscutting, and Spring-AspectJ integration. Building on familiar technologies such as JDBC, Hibernate, JPA, Spring Security, Spring MVC, and Swing, you'll apply AOP to common problems encountered in enterprise applications.

This book requires no previous experience in AOP and AspectJ, but it assumes you're familiar with OOP, Java, and the basics of Spring.

Table of Contents show full

foreword

preface

preface to the first edition

acknowledgments

about this book

about the title

about the cover illustration

a real-world perspective of AOP

Part 1 Understanding AOP and AspectJ

1. Discovering AOP

1.1. Life without AOP

1.2. Modularizing with AOP

1.3. Anatomy of an AOP language

1.4. Fundamental concepts in AOP

1.5. AOP by analogy

1.6. Implementations of AOP

1.7. Alternatives to AOP

1.8. Costs and benefits of AOP

1.9. Summary

2. Introducing AspectJ

2.1. Writing your first AspectJ program

2.2. AspectJ crosscutting construct

2.3. AspectJ alternative syntax

2.4. Weaving mechanisms

2.5. AspectJ weaving: under the hood

2.6. Spring AspectJ integration

2.7. AspectJ logistics overview

2.8. Summary

3. Understanding the join point model

3.1. Understanding the join point model

3.2. Categorizing exposed join points

3.3. Join point demonstration example

3.4. Understanding pointcut basics

3.5. Signature syntax

3.6. Implementing pointcuts

3.7. Summary

4. Modifying behavior with dynamic crosscutting

4.1. Advice overview

4.2. Comparing advice to methods

4.3. Advice in depth

4.4. Collecting join point context

4.5. Accessing join point context via reflection

4.6. Summary

5. Modifying structure with static crosscutting

5.1. Introducing members

5.2. Modifying the type hierarchy

5.3. Introducing members to multiple types

5.4. Supplying annotations

5.5. Declaring weave-time errors and warnings

5.6. Softening checked exceptions

5.7. Summary

6. Aspects: putting it all together

6.1. Working with aspects

6.2. Aspect association

6.3. Aspect precedence

6.4. Privileged aspects

6.5. Summary

7. Diving into the @AspectJ syntax

7.1. Syntax overview

7.2. Mapping aspects

7.3. Mapping pointcuts

7.4. Mapping dynamic crosscutting constructs

7.5. Mapping static crosscutting

7.6. Features not implemented in @AspectJ

7.7. Comparing syntax styles

7.8. Summary

8. AspectJ weaving models

8.1. Classifying weaving models

8.2. Build-time weaving

8.3. Load-time weaving

8.4. Load-time weaver in action

8.5. Choosing syntax and weaving

8.6. Summary

9. Integration with Spring

9.1. Spring AOP fundamentals

9.2. Spring AOP under the hood

9.3. @AspectJ support in depth

9.4. Schema-style AOP support

9.5. Tapping into the full power of AspectJ

9.6. Choosing an appropriate AOP system

9.7. Summary

Part 2 Applications of AspectJ with Spring

10. Monitoring techniques

10.1. Tracing in action

10.2. Conventional vs. AOP tracing

10.3. Selecting join points of interest

10.4. Tracing

10.5. A detour: deployment options for monitoring aspects

10.6. Exception monitoring

10.7. Improving conventional logging

10.8. Performance monitoring

10.9. Runtime control of monitoring aspects

10.10. Summary

11. Policy enforcement: keeping your design intact

11.1. AOP-based policy enforcement overview

11.2. Policy origins and destinations

11.3. Enforcement using AOP

11.4. Comparison with code-analysis tools

11.5. Implementing flexible access control

11.6. Enforcement idiom: return-value restriction

11.7. Enforcing JPA-JDBC integration policies

11.8. Implementing EJB policies

11.9. Detecting Swing concurrency control policy violations

11.10. Summary

12. Learning design patterns

12.1. The worker object pattern

12.2. The wormhole pattern

12.3. The participant pattern

12.4. Annotation-driven participant pattern

12.5. Summary

13. Implementing concurrency control

13.1. Modularizing Swing’s single-thread rule

13.2. Improving the responsiveness of UI applications

13.3. Modularizing the read-write lock pattern

13.4. Summary

14. Managing transactions

14.1. Transaction management implementations

14.2. Transaction-management players

14.3. Aspect implementation choices

14.4. Transaction-management aspect (almost) from scratch

14.5. Spring’s transaction management

14.6. Implementing fault tolerance for transactional operations

14.7. Summary

15. Securing applications

15.1. Securing applications with conventional techniques

15.2. Modularizing security using AOP

15.3. A quick overview of Spring Security

15.4. Implementing a security solution from scratch

15.5. Implementing field-level authorization

15.6. Spring Security prebuilt solutions

15.7. Additional ideas in implementing security

15.8. Summary

16. Improving domain logic

16.1. Empowering objects

16.2. Implementing business logic

16.3. Managing access to objects

16.4. Summary

17. Taking the next step

17.1. The adoption path: technologies

17.2. The adoption path: applications

17.3. Applying AOP to new problems

17.4. Employing AOP in development phases

17.5. Parting thoughts

Appendix A: : Setting up the example

Appendix B: : Using Ant with AspectJ

Appendix C: : Using Maven with AspectJ

index

© 2014 Manning Publications Co.

About the book

AspectJ in Action, Second Edition is a fully updated, major revision of Ramnivas Laddad's best-selling first edition. It's a hands-on guide for Java developers. After introducing the core principles of AOP, it shows you how to create reusable solutions using AspectJ 6 and Spring 3. You'll master key features including annotation-based syntax, load-time weaver, annotation-based crosscutting, and Spring-AspectJ integration. Building on familiar technologies such as JDBC, Hibernate, JPA, Spring Security, Spring MVC, and Swing, you'll apply AOP to common problems encountered in enterprise applications.

What's inside

  • Totally revised Second Edition
  • When and how to apply AOP
  • Master patterns and best practices
  • Code you can reuse in real-world applications

About the reader

This book requires no previous experience in AOP and AspectJ, but it assumes you're familiar with OOP, Java, and the basics of Spring.

About the author

An expert in enterprise Java, Ramnivas Laddad is well known in the area of AOP and Spring. He is a committer on the Spring Framework project.


combo $49.99 pBook + eBook
eBook $39.99 pdf + ePub + kindle

FREE domestic shipping on three or more pBooks

Ramnivas showcases how to get the best out of AspectJ and Spring.

Andy Clement, AspectJ Project Lead

One of the best Java books in years.

Andrew Rhine, eSecLending

By far the best reference for Spring AOP and AspectJ.

Paul Benedict, Argus Health Systems

Ramnivas expertly demystifies the awesome power of aspect-oriented programming.

Craig Walls, author of Spring in Action