-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)theme: aotAn issue related to Ahead-of-time processingAn issue related to Ahead-of-time processingtype: bugA general bugA general bug
Milestone
Description
Affects: 6.x
MockitoPostProcessor
has been deprecated in Spring Boot. AOT processing of an application's tests generates code like this:
/**
* Get the bean definition for 'spyPostProcessor'.
*/
public static BeanDefinition getSpyPostProcessorBeanDefinition() {
RootBeanDefinition beanDefinition = new RootBeanDefinition(MockitoPostProcessor.SpyPostProcessor.class);
beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
beanDefinition.getConstructorArgumentValues().addIndexedArgumentValue(0, new RuntimeBeanReference("org.springframework.boot.test.mock.mockito.MockitoPostProcessor"));
beanDefinition.setInstanceSupplier(getSpyPostProcessorInstanceSupplier());
return beanDefinition;
}
This results in a deprecation warning for MockitoPostProcessor
.
Note that the generated code correctly suppresses warnings for using MockitoPostProcessor
directly:
/**
* Get the bean definition for 'mockitoPostProcessor'.
*/
@SuppressWarnings("deprecation")
public static BeanDefinition getMockitoPostProcessorBeanDefinition() {
RootBeanDefinition beanDefinition = new RootBeanDefinition(MockitoPostProcessor.class);
beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
beanDefinition.getConstructorArgumentValues().addIndexedArgumentValue(0, Collections.emptySet());
beanDefinition.setInstanceSupplier(getMockitoPostProcessorInstanceSupplier());
return beanDefinition;
}
Referring to the SpyPostProcessor
nested class appears to be enough to throw off the deprecated API detection.
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)theme: aotAn issue related to Ahead-of-time processingAn issue related to Ahead-of-time processingtype: bugA general bugA general bug