JtaTransactionManagerFactoryBean fully initializes its JTM instance
Closes gh-22605
This commit is contained in:
parent
271445b89e
commit
d6c1a65737
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -18,7 +18,9 @@ package org.springframework.transaction.config;
|
|||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.TransactionSystemException;
|
||||
import org.springframework.transaction.jta.JtaTransactionManager;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
|
@ -32,7 +34,7 @@ import org.springframework.util.ClassUtils;
|
|||
* @see org.springframework.transaction.jta.WebLogicJtaTransactionManager
|
||||
* @see org.springframework.transaction.jta.WebSphereUowTransactionManager
|
||||
*/
|
||||
public class JtaTransactionManagerFactoryBean implements FactoryBean<JtaTransactionManager> {
|
||||
public class JtaTransactionManagerFactoryBean implements FactoryBean<JtaTransactionManager>, InitializingBean {
|
||||
|
||||
private static final String WEBLOGIC_JTA_TRANSACTION_MANAGER_CLASS_NAME =
|
||||
"org.springframework.transaction.jta.WebLogicJtaTransactionManager";
|
||||
|
@ -55,7 +57,6 @@ public class JtaTransactionManagerFactoryBean implements FactoryBean<JtaTransact
|
|||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
private final JtaTransactionManager transactionManager;
|
||||
|
||||
|
||||
|
@ -73,6 +74,11 @@ public class JtaTransactionManagerFactoryBean implements FactoryBean<JtaTransact
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws TransactionSystemException {
|
||||
this.transactionManager.afterPropertiesSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public JtaTransactionManager getObject() {
|
||||
|
@ -81,7 +87,7 @@ public class JtaTransactionManagerFactoryBean implements FactoryBean<JtaTransact
|
|||
|
||||
@Override
|
||||
public Class<?> getObjectType() {
|
||||
return (this.transactionManager != null ? this.transactionManager.getClass() : JtaTransactionManager.class);
|
||||
return this.transactionManager.getClass();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue