Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using TransactionProxyFactoryBean breaks Spring Batch #4425

Open
wklaus opened this issue Jul 26, 2023 · 0 comments
Open

Using TransactionProxyFactoryBean breaks Spring Batch #4425

wklaus opened this issue Jul 26, 2023 · 0 comments
Labels
has: minimal-example Bug reports that provide a minimal complete reproducible example type: bug

Comments

@wklaus
Copy link
Contributor

wklaus commented Jul 26, 2023

Bug description
When a TransactionProxyFactoryBean is configured in a XML-File then the application stops starting with an exception when initializing the datasource because the properties not injected at this time. The Bean is created because Spring tries to find out on wich class is the Annotation EnableBatchProcessing. The error happens only when Spring-Batch-Dependencies in the classpath.

Environment
Spring Batch 3.0.9, Java Version: 17.0.2, H2-Database

Steps to reproduce
Add an XML-File with the configuration of an TransactionProxyFactorBean like the following

<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd">
    <bean id="eineBeanMitTransacton" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
        <property name="transactionManager" ref="transactionManagerApp"/>
        <property name="transactionAttributes">
            <props>
                <prop key="*">PROPAGATION_REQUIRES_NEW,timeout_200</prop>
            </props>
        </property>
        <property name="target">
            <bean class="de.wkl.battest.dao.PDaoImpl"/>
        </property>
    </bean>
</beans>

Use this configuration with ImportResource-Annotation

Expected behavior
The Spring-Context should be loaded. With Spring Boot 2.x and Spring Batch 4.x this is not a problem

Minimal Complete Reproducible example
Attached is a minimal example. BattestApplicationTests fails. After removing the ImportResource-Annotation in BatchConfig the Test is green

batchTest.zip

@wklaus wklaus added status: waiting-for-triage Issues that we did not analyse yet type: bug labels Jul 26, 2023
@fmbenhassine fmbenhassine added has: minimal-example Bug reports that provide a minimal complete reproducible example and removed status: waiting-for-triage Issues that we did not analyse yet labels Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has: minimal-example Bug reports that provide a minimal complete reproducible example type: bug
Projects
None yet
Development

No branches or pull requests

2 participants