You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Team , i have migrated to Java 17 and Spring 3.4x , when i try to build my functional test cases are failing with the below error :
java.lang.IllegalStateException: ApplicationContext failure threshold (1) exceeded: skipping repeated attempt to load context for [WebMergedContextConfiguration@7778822b testClass = com.test.EmployeeFunctionalTestSpec, locations = [], classes = [com.api.EmployeeApplication, com.api.test.logging.LogbackMapAppender], contextInitializerClasses = [], activeProfiles = [], propertySourceDescriptors = [], propertySourceProperties = ["org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true", "server.port=0"], contextCustomizers = [org.springframework.test.context.support.DynamicPropertiesContextCustomizer@0, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@57459491, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@7e22550a, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@36f48b4, org.springframework.boot.test.web.reactor.netty.DisableReactorResourceFactoryGlobalResourcesContextCustomizerFactory$DisableReactorResourceFactoryGlobalResourcesContextCustomizerCustomizer@7fc6de5b, org.springframework.boot.test.autoconfigure.OnFailureConditionReportContextCustomizerFactory$OnFailureConditionReportContextCustomizer@60a2630a, org.springframework.boot.test.autoconfigure.actuate.observability.ObservabilityContextCustomizerFactory$DisableObservabilityContextCustomizer@1f, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizer@10c626be, org.spockframework.spring.mock.SpockContextCustomizer@0, org.springframework.boot.test.context.SpringBootTestAnnotation@20a2f009], resourceBasePath = "src/main/webapp", contextLoader = org.springframework.boot.test.context.SpringBootContextLoader, parent = null]
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:145)
at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:130)
at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:204)
at org.spockframework.spring.SpringTestContext.getApplicationContext(SpringTestContext.java:49)
at org.spockframework.spring.SpringMockTestExecutionListener.injectSpies(SpringMockTestExecutionListener.java:66)
at org.spockframework.spring.SpringMockTestExecutionListener.prepareTestInstance(SpringMockTestExecutionListener.java:62)
at org.spockframework.spring.AbstractSpringTestExecutionListener.prepareTestInstance(AbstractSpringTestExecutionListener.java:32)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:260)
at org.spockframework.spring.SpringTestContextManager.prepareTestInstance(SpringTestContextManager.java:56)
at org.spockframework.spring.SpringInterceptor.interceptInitializerMethod(SpringInterceptor.java:46)
at org.spockframework.runtime.extension.AbstractMethodInterceptor.intercept(AbstractMethodInterceptor.java:24)
at org.spockframework.runtime.extension.MethodInvocation.proceed(MethodInvocation.java:122)
at org.spockframework.runtime.extension.IDataDriver.lambda$static$0(IDataDriver.java:38)
at org.spockframework.runtime.model.MethodInfo.invoke(MethodInfo.java:157)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.spockframework.runtime.model.MethodInfo.invoke(MethodInfo.java:157)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
pom.xml :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.0</version>
<configuration>
<fork>true</fork>
<meminitial>2024m</meminitial>
<forceJavacCompilerUse>true</forceJavacCompilerUse>
<useIncrementalCompilation>true</useIncrementalCompilation>
<generatedSourcesDirectory>${project.build.directory}/map-struct</generatedSourcesDirectory>
<annotationProcessorPaths>
<!-- careful to preserve ordering otherwise lombok builders not used by mapstruct and NPEs occur! -->
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>1.5.5.Final</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>1.18.36</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-mapstruct-binding</artifactId>
<version>0.2.0</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
Service.java
@Slf4j
@Service
@AllArgsConstructor
public class EmployeeyNotificationService {
private final EmployeeCodeRequestMapper employeeCodeRequestMapper;
}
I understood that the error is because the Service class is expecting the Mapper object to be invoked by @autowire annotaion , but i have defined the relevant annotationProcessorPath where it has be handled when @SpringBootTest is initated and thats how it worked in earlier version of Spring 2x . Now the Mapper beans are not invoked by default , Can you help how to fix this ?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Team , i have migrated to Java 17 and Spring 3.4x , when i try to build my functional test cases are failing with the below error :
pom.xml :
Service.java
I understood that the error is because the Service class is expecting the Mapper object to be invoked by @autowire annotaion , but i have defined the relevant annotationProcessorPath where it has be handled when @SpringBootTest is initated and thats how it worked in earlier version of Spring 2x . Now the Mapper beans are not invoked by default , Can you help how to fix this ?
Beta Was this translation helpful? Give feedback.
All reactions