private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { // Rely on default serialization, although this class itself doesn't carry state anyway... ois.defaultReadObject(); // Serialize all relevant superclass fields. // Superclass can't implement Serializable because it also serves as base class // for AspectJ aspects (which are not allowed to implement Serializable)! setTransactionManagerBeanName((String) ois.readObject()); setTransactionManager((PlatformTransactionManager) ois.readObject()); setTransactionAttributeSource((TransactionAttributeSource) ois.readObject()); setBeanFactory((BeanFactory) ois.readObject()); }
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { // Rely on default serialization, although this class itself doesn't carry state anyway... ois.defaultReadObject(); // Serialize all relevant superclass fields. // Superclass can't implement Serializable because it also serves as base class // for AspectJ aspects (which are not allowed to implement Serializable)! setTransactionManagerBeanName((String) ois.readObject()); setTransactionManager((PlatformTransactionManager) ois.readObject()); setTransactionAttributeSource((TransactionAttributeSource) ois.readObject()); setBeanFactory((BeanFactory) ois.readObject()); }
private TransactionInterceptor createTransactionInterceptor(BeanFactory beanFactory, String transactionManagerName, PlatformTransactionManager transactionManager) { TransactionInterceptor ti = new TransactionInterceptor(); if (beanFactory != null) { ti.setBeanFactory(beanFactory); } if (transactionManagerName != null) { ti.setTransactionManagerBeanName(transactionManagerName); } if (transactionManager != null) { ti.setTransactionManager(transactionManager); } ti.setTransactionAttributeSource(new NameMatchTransactionAttributeSource()); ti.afterPropertiesSet(); return ti; }
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { // Rely on default serialization, although this class itself doesn't carry state anyway... ois.defaultReadObject(); // Serialize all relevant superclass fields. // Superclass can't implement Serializable because it also serves as base class // for AspectJ aspects (which are not allowed to implement Serializable)! setTransactionManagerBeanName((String) ois.readObject()); setTransactionManager((PlatformTransactionManager) ois.readObject()); setTransactionAttributeSource((TransactionAttributeSource) ois.readObject()); setBeanFactory((BeanFactory) ois.readObject()); }
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { // Rely on default serialization, although this class itself doesn't carry state anyway... ois.defaultReadObject(); // Serialize all relevant superclass fields. // Superclass can't implement Serializable because it also serves as base class // for AspectJ aspects (which are not allowed to implement Serializable)! setTransactionManagerBeanName((String) ois.readObject()); setTransactionManager((PlatformTransactionManager) ois.readObject()); setTransactionAttributeSource((TransactionAttributeSource) ois.readObject()); setBeanFactory((BeanFactory) ois.readObject()); }
/** * Creates a new {@link TransactionalRepositoryProxyPostProcessor}. */ public TransactionalRepositoryProxyPostProcessor(ListableBeanFactory beanFactory, String transactionManagerName) { Assert.notNull(beanFactory); Assert.notNull(transactionManagerName); this.petInterceptor = new PersistenceExceptionTranslationInterceptor(); this.petInterceptor.setBeanFactory(beanFactory); this.petInterceptor.afterPropertiesSet(); this.transactionInterceptor = new TransactionInterceptor(null, new CustomAnnotationTransactionAttributeSource()); this.transactionInterceptor.setTransactionManagerBeanName(transactionManagerName); this.transactionInterceptor.setBeanFactory(beanFactory); this.transactionInterceptor.afterPropertiesSet(); }
public void postProcess(ProxyFactory factory, RepositoryInformation repositoryInformation) { CustomAnnotationTransactionAttributeSource transactionAttributeSource = new CustomAnnotationTransactionAttributeSource(); transactionAttributeSource.setRepositoryInformation(repositoryInformation); transactionAttributeSource.setEnableDefaultTransactions(enableDefaultTransactions); @SuppressWarnings("null") // TODO: Remove TransactionInterceptor transactionInterceptor = new TransactionInterceptor(null, transactionAttributeSource); transactionInterceptor.setTransactionManagerBeanName(transactionManagerName); transactionInterceptor.setBeanFactory(beanFactory); transactionInterceptor.afterPropertiesSet(); factory.addAdvice(transactionInterceptor); }