/** * This callback is optional: If running in a BeanFactory and no transaction * manager has been set explicitly, a single matching bean of type * {@link PlatformTransactionManager} will be fetched from the BeanFactory. * @see org.springframework.beans.factory.BeanFactory#getBean(Class) * @see org.springframework.transaction.PlatformTransactionManager */ @Override public void setBeanFactory(BeanFactory beanFactory) { this.transactionInterceptor.setBeanFactory(beanFactory); }
/** * This callback is optional: If running in a BeanFactory and no transaction * manager has been set explicitly, a single matching bean of type * {@link PlatformTransactionManager} will be fetched from the BeanFactory. * @see org.springframework.beans.factory.BeanFactory#getBean(Class) * @see org.springframework.transaction.PlatformTransactionManager */ @Override public void setBeanFactory(BeanFactory beanFactory) { this.transactionInterceptor.setBeanFactory(beanFactory); }
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; }
/** * This callback is optional: If running in a BeanFactory and no transaction * manager has been set explicitly, a single matching bean of type * {@link PlatformTransactionManager} will be fetched from the BeanFactory. * @see org.springframework.beans.factory.BeanFactory#getBean(Class) * @see org.springframework.transaction.PlatformTransactionManager */ @Override public void setBeanFactory(BeanFactory beanFactory) { this.transactionInterceptor.setBeanFactory(beanFactory); }
/** * This callback is optional: If running in a BeanFactory and no transaction * manager has been set explicitly, a single matching bean of type * {@link PlatformTransactionManager} will be fetched from the BeanFactory. * @see org.springframework.beans.factory.BeanFactory#getBean(Class) * @see org.springframework.transaction.PlatformTransactionManager */ @Override public void setBeanFactory(BeanFactory beanFactory) { this.transactionInterceptor.setBeanFactory(beanFactory); }
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()); }
protected Advice transactionInterceptor(PlatformTransactionManager ptm) { TransactionInterceptor transactionInterceptor = new TransactionInterceptor(this.ptm, new AnnotationTransactionAttributeSource()); transactionInterceptor.setBeanFactory(beanFactory); transactionInterceptor.afterPropertiesSet(); return transactionInterceptor; } }
/** * 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); }