Skip to content

Commit

Permalink
Remove TransactionManager
Browse files Browse the repository at this point in the history
  • Loading branch information
jacodg committed Apr 17, 2024
1 parent 95cdbd8 commit a68ad85
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
15 changes: 1 addition & 14 deletions src/main/java/nl/nn/testtool/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,9 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.Scope;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.jdbc.datasource.SimpleDriverDataSource;
import org.springframework.transaction.TransactionManager;
import org.springframework.transaction.annotation.TransactionManagementConfigurer;

import io.quarkus.arc.DefaultBean;
import nl.nn.testtool.echo2.ComparePane;
Expand Down Expand Up @@ -100,7 +96,7 @@
@Singleton
@Scope("singleton")
@Configuration
public class Config implements TransactionManagementConfigurer {
public class Config {

@Bean
@Scope("prototype") // Echo2Application needs to be unique per user (not per JVM)
Expand Down Expand Up @@ -231,15 +227,6 @@ DataSource dataSource() {
return new SimpleDriverDataSource();
}

@Bean
@Primary
@Override
public TransactionManager annotationDrivenTransactionManager() {
DataSourceTransactionManager tx = new DataSourceTransactionManager();
tx.setDataSource(dataSource());
return tx;
}

@Bean
JdbcTemplate jdbcTemplate(DataSource dataSource) {
JdbcTemplate jdbcTemplate = new JdbcTemplate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.PreparedStatementSetter;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.transaction.annotation.Transactional;

import lombok.Getter;
import lombok.Setter;
Expand All @@ -59,12 +57,6 @@
/**
* @author Jaco de Groot
*/
// With transaction manager configured auto-commit is disabled and PostgreSQL will not throw the following exception
// on insert of a report: org.postgresql.util.PSQLException: Large Objects may not be used in auto-commit mode.
// Without proxyTargetClass = true the test webapp will give: Bean named 'proofOfMigrationStorage' is expected to be of
// type 'nl.nn.testtool.storage.proofofmigration.ProofOfMigrationStorage' but was actually of type 'jdk.proxy3.$Proxy26'
@EnableTransactionManagement(proxyTargetClass = true)
@Transactional
// @Dependent disabled for Quarkus for now because of the use of JdbcTemplate
public class DatabaseStorage implements LogStorage, CrudStorage {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
Expand Down

0 comments on commit a68ad85

Please sign in to comment.