Running into an error after upgrading springboot from 2.3.9 to 2.6.3
Asked Answered
G

1

14

After upgrading from springboot 2.3.9 to 2.6.6 I have a failing tests with the following error,

java.lang.AssertionError: 
Expecting:
 <Unstarted application context org.springframework.boot.test.context.assertj.AssertableApplicationContext[startupFailure=org.springframework.beans.factory.UnsatisfiedDependencyException]>
to have a single bean of type:
 <com.air.dx.range.application.RangeApplicationService>:
but context failed to start:
 org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'IRoRangeRepository': Unsatisfied dependency expressed through method 'setDialect' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.data.relational.core.dialect.Dialect' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
    

One observation after upgrading,

The class ConfigFileApplicationContextInitializer from spring-boot-test jar is modified to ConfigDataApplicationContextInitializer.

Gidgetgie answered 24/3, 2022 at 14:34 Comment(3)
Thanks for the observation, we ran into the same issue. Weird that this seems to not be documented anywhere (or I couldn't find it)Obau
Please post your pom.xml as this clearly a dependency problemVersicle
Which database are you using in failing test?Cottony
G
2

Yes, this is a legal assumption and it is the case. Actually, in spring-boot 2.4.0 ConfigFileApplicationContextInitializer was already marked as deprecated in favor ConfigDataApplicationContextInitializer. Just be aware that ConfigFileApplicationContextInitializer no longer exists in spring-boot starting from 3.0.0.
So you can just switch to ConfigDataApplicationContextInitializer and that should be enough.

Geraldgeralda answered 23/12, 2023 at 14:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.