Updated project to use Spring Boot 3.0
Resolves issues: TASK-810 TASK-812 TASK-813
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2019 the original author or authors.
|
||||
* Copyright 2015-2022 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.
|
||||
@@ -16,9 +16,9 @@
|
||||
|
||||
package org.springframework.cloud.task.configuration;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2019 the original author or authors.
|
||||
* Copyright 2015-2022 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.
|
||||
@@ -16,11 +16,14 @@
|
||||
|
||||
package org.springframework.cloud.task.repository.support;
|
||||
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.springframework.jdbc.support.DatabaseMetaDataCallback;
|
||||
import org.springframework.jdbc.support.JdbcUtils;
|
||||
import org.springframework.jdbc.support.MetaDataAccessException;
|
||||
import org.springframework.util.StringUtils;
|
||||
@@ -107,15 +110,27 @@ public enum DatabaseType {
|
||||
* @throws MetaDataAccessException thrown if failure occurs on metadata lookup.
|
||||
*/
|
||||
public static DatabaseType fromMetaData(DataSource dataSource)
|
||||
throws MetaDataAccessException {
|
||||
throws SQLException, MetaDataAccessException {
|
||||
String databaseProductName = JdbcUtils
|
||||
.extractDatabaseMetaData(dataSource, "getDatabaseProductName").toString();
|
||||
.extractDatabaseMetaData(dataSource, new DatabaseMetaDataCallback() {
|
||||
|
||||
@Override
|
||||
public Object processMetaData(DatabaseMetaData dbmd) throws SQLException, MetaDataAccessException {
|
||||
return dbmd.getDatabaseProductName();
|
||||
}
|
||||
}).toString();
|
||||
if (StringUtils.hasText(databaseProductName)
|
||||
&& !databaseProductName.equals("DB2/Linux")
|
||||
&& databaseProductName.startsWith("DB2")) {
|
||||
String databaseProductVersion = JdbcUtils
|
||||
.extractDatabaseMetaData(dataSource, "getDatabaseProductVersion")
|
||||
.toString();
|
||||
.extractDatabaseMetaData(dataSource, new DatabaseMetaDataCallback() {
|
||||
|
||||
@Override
|
||||
public Object processMetaData(DatabaseMetaData dbmd) throws SQLException, MetaDataAccessException {
|
||||
return dbmd.getDatabaseProductVersion();
|
||||
}
|
||||
}).toString();
|
||||
|
||||
if (databaseProductVersion.startsWith("ARI")) {
|
||||
databaseProductName = "DB2VSE";
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2021 the original author or authors.
|
||||
* Copyright 2015-2022 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.
|
||||
@@ -132,6 +132,9 @@ public class TaskExecutionDaoFactoryBean implements FactoryBean<TaskExecutionDao
|
||||
catch (MetaDataAccessException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
catch (SQLException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
((JdbcTaskExecutionDao) this.dao).setTaskIncrementer(incrementerFactory
|
||||
.getIncrementer(databaseType, this.tablePrefix + "SEQ"));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2019 the original author or authors.
|
||||
* Copyright 2015-2022 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.
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.cloud.task.repository.support;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -89,6 +91,9 @@ public final class TaskRepositoryInitializer implements InitializingBean {
|
||||
catch (MetaDataAccessException ex) {
|
||||
throw new IllegalStateException("Unable to detect database type", ex);
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
throw new IllegalStateException("Unable to detect database type", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user