Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

DataSourceConnectionAspectAnno.java 577B

1234567891011121314151617181920
  1. package foo;
  2. import javax.sql.DataSource;
  3. import org.aspectj.lang.JoinPoint;
  4. import org.aspectj.lang.annotation.Aspect;
  5. import org.aspectj.lang.annotation.Before;
  6. import org.aspectj.lang.annotation.DeclareParents;
  7. @Aspect
  8. public class DataSourceConnectionAspectAnno {
  9. // This statement crashes the AspectJ compiler
  10. @DeclareParents("foo.BaseClass")
  11. private DataSource dataSource;
  12. @Before("execution(public java.sql.Connection javax.sql.DataSource+.getConnection(..))")
  13. public void myAdvice(JoinPoint thisJoinPoint) {
  14. System.out.println(thisJoinPoint);
  15. }
  16. }