#AbstractSingletonProxyFactoryBean
1 messages · Page 1 of 1 (latest)
AbstractSingletonProxyFactoryBean
import org.springframework.aop.framework.AbstractSingletonProxyFactoryBean;
import org.springframework.aop.TargetSource;
import org.springframework.aop.target.SingletonTargetSource;
public class CustomSingletonProxyFactoryBean extends AbstractSingletonProxyFactoryBean {
private final Object service;
public CustomSingletonProxyFactoryBean(Object service) {
this.service = service;
}
@Override
protected Object createMainInterceptor() {
// Create your custom interceptor here and return it.
// You can extend the org.aopalliance.intercept.MethodInterceptor class and override its invoke method.
}
@Override
protected TargetSource createTargetSource() {
// Create and return a SingletonTargetSource with the service object as the target.
return new SingletonTargetSource(service);
}
}```