org.aspectj/tests/bugs169/pr295491/SpringConfigurableMixin.java
2010-01-25 22:47:06 +00:00

31 lines
882 B
Java

package com.j4fe.aspects;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Entity;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.beans.factory.annotation.Autowired;
public aspect SpringConfigurableMixin {
public static interface EntityManagerAware {
EntityManager getEntityManager();
}
// not working
// declare @type : (@Entity *) : @Configurable(autowire = Autowire.BY_TYPE, preConstruction = true);
// also not working
// declare @type : (@Entity *) : @Configurable
declare parents : (@Entity *) implements EntityManagerAware;
@PersistenceContext
transient private EntityManager EntityManagerAware.entityManager;
public EntityManager EntityManagerAware.getEntityManager() {
return entityManager;
}
}