Spring 升级到 Apache Derby 10.15 后启动应用程序中断 -- 为什么?
Spring Boot application breaks after upgrade to Apache Derby 10.15 -- why?
在 Spring 引导应用程序的一轮 SOUP 升级期间,我将 Apache Derby 从 10.14.1.0 升级到 10.15.1.3。现在测试失败了这个美丽(剪断,完整的堆栈跟踪 here):
Failed to load ApplicationContext
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration':
Unsatisfied dependency expressed through constructor parameter 0
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'dataSource':
Invocation of init method failed
Caused by: java.lang.IllegalStateException:
Failed to replace DataSource with an embedded database for tests.
If you want an embedded database please put a supported one on the
classpath or tune the replace attribute of @AutoConfigureTestDatabase.
这是怎么回事?我需要更改任何配置吗?
Apache Derby 需要 Java 10 中的 9。15.x 当前不支持 Spring Boot。
我只想回答我是如何让 Derby 15.2.0 与 Spring Boot 2.4.4 with derby 在嵌入式模式下工作,在 Java 11 之上。 Spring Boot 2.4.4 与 Derby 14 开箱即用,尽管您会在 spring 启动时收到一些警告。将 apache derby 升级到 15.2.0 为我解决了这个问题。
在 pom 中,定义了 derby 和 derbytools 依赖项:
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.15.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbytools</artifactId>
<version>10.15.2.0</version>
</dependency>
然后在您的应用属性文件中:
spring.datasource.driver-class-姓名=org.apache.derby.iapi.jdbc.AutoloadedDriver
而不是:
spring.datasource.driver-class-姓名=org.apache.derby.jdbc.EmbeddedDriver
在那之后,我现在可以很好地启动 Spring 启动,没有任何警告或任何引起关注的问题。
在 Spring 引导应用程序的一轮 SOUP 升级期间,我将 Apache Derby 从 10.14.1.0 升级到 10.15.1.3。现在测试失败了这个美丽(剪断,完整的堆栈跟踪 here):
Failed to load ApplicationContext
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration':
Unsatisfied dependency expressed through constructor parameter 0
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'dataSource':
Invocation of init method failed
Caused by: java.lang.IllegalStateException:
Failed to replace DataSource with an embedded database for tests.
If you want an embedded database please put a supported one on the
classpath or tune the replace attribute of @AutoConfigureTestDatabase.
这是怎么回事?我需要更改任何配置吗?
Apache Derby 需要 Java 10 中的 9。15.x 当前不支持 Spring Boot。
我只想回答我是如何让 Derby 15.2.0 与 Spring Boot 2.4.4 with derby 在嵌入式模式下工作,在 Java 11 之上。 Spring Boot 2.4.4 与 Derby 14 开箱即用,尽管您会在 spring 启动时收到一些警告。将 apache derby 升级到 15.2.0 为我解决了这个问题。
在 pom 中,定义了 derby 和 derbytools 依赖项:
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.15.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbytools</artifactId>
<version>10.15.2.0</version>
</dependency>
然后在您的应用属性文件中:
spring.datasource.driver-class-姓名=org.apache.derby.iapi.jdbc.AutoloadedDriver
而不是: spring.datasource.driver-class-姓名=org.apache.derby.jdbc.EmbeddedDriver
在那之后,我现在可以很好地启动 Spring 启动,没有任何警告或任何引起关注的问题。