mirror of
https://github.com/eclipse-aspectj/aspectj.git
synced 2024-08-17 02:10:44 +02:00
31 lines
882 B
Java
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;
|
|
}
|
|
}
|