I upgrade my code to spring-boot 3.2.0 dependencies: starter-data-jdbc,starter-data-jpa,starter-data-redis,starter-jdbc,starter-security,starter-web....
when use gradle bootRun command ,output so many WARN mesage like:
2023-11-27T15:40:01.396+08:00 WARN 20020 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'liaisonInCustomerRoleService' of type [com.gdtech.oadingtalk.service.contractmanager.fundamentals.LiaisonInCustomerRoleService] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [**projectingArgumentResolverBeanPostProcessor**]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-11-27T15:40:01.430+08:00 WARN 20020 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'customerRoledLiaisonRepository' of type [jdk.proxy2.$Proxy1478] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [**projectingArgumentResolverBeanPostProcessor**]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-11-27T15:56:28.592+08:00 WARN 23981 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'jpa.named-queries#2280' of type [org.springframework.data.repository.core.support.**PropertiesBasedNamedQueries**] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [**projectingArgumentResolverBeanPostProcessor**]? Check the corresponding BeanPostProcessor declaration and its dependencies.
almost every calss annotation with Service or Repoistory ouput WARN message like above.
I don't define a BeanPostProcessor name ProjectingArgumentResolverBeanPostProcessor in my code. those WARN message seriously slowing down the startup speed. Are there any suggestions about how best to tackle the problem? thanks a lot!
Comment From: wilkinsona
projectingArgumentResolverBeanPostProcessor is defined by Spring Data JPA. Please report this to them.
those WARN message seriously slowing down the startup speed
FWIW, I think that's unlikely. The cost of a single log message is pretty minimal. If you're seeing a serious slow down in startup time, you many have an additional problem.
Comment From: mp911de
Spring Data isn't registering any of these config classes itself nor have the config classes/the bean post-processor seen any change in the past couple years.
Chances are high that something else has changed that lets BeanPostProcessorChecker kick in.
Comment From: billschen
I update my code many times .my first version code is spring boot 2.1.
Comment From: wilkinsona
@billschen, if you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.
Comment From: billschen
ok. I will put a attach file as soon as~ I debug my code in a minimal smaple. the warn message happen when I create custom method security expression handler. CustomMethodSecurityExpressionHandler:
package com.kbnotebooks.qywx.config;
import com.kbnotebooks.qywx.repository.produce.block.BlockRepository; // a repository
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler;
import org.springframework.security.access.expression.method.MethodSecurityExpressionOperations;
import org.springframework.security.authentication.AuthenticationTrustResolver;
import org.springframework.security.authentication.AuthenticationTrustResolverImpl;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Component;
@Component
public class CustomMethodSecurityExpressionHandler extends DefaultMethodSecurityExpressionHandler {
private final AuthenticationTrustResolver trustResolver = new AuthenticationTrustResolverImpl();
private final BlockRepository blockRepository;
public CustomMethodSecurityExpressionHandler(BlockRepository blockRepository) {
this.blockRepository = blockRepository;
}
@Override
protected MethodSecurityExpressionOperations createSecurityExpressionRoot(Authentication authentication, MethodInvocation invocation) {
CustomMethodSecurityExpressionRoot root = new CustomMethodSecurityExpressionRoot(authentication, blockRepository);
root.setPermissionEvaluator(this.getPermissionEvaluator());
root.setTrustResolver(this.trustResolver);
root.setRoleHierarchy(this.getRoleHierarchy());
return root;
}
}
CustomMethodSecurityExpressionRoot
package com.kbnotebooks.qywx.config;
import com.kbnotebooks.qywx.repository.produce.block.BlockRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.expression.SecurityExpressionRoot;
import org.springframework.security.access.expression.method.MethodSecurityExpressionOperations;
import org.springframework.security.core.Authentication;
@Slf4j
public class CustomMethodSecurityExpressionRoot extends SecurityExpressionRoot implements MethodSecurityExpressionOperations {
private BlockRepository blockRepository;
private Object filterObject;
private Object returnObject;
private Object target;
public CustomMethodSecurityExpressionRoot(Authentication authentication, BlockRepository blockRepository) {
super(authentication);
this.blockRepository = blockRepository;
}
// other method...
}
and the warn message out put like:
2023-11-28T17:59:41.911+08:00 WARN 18703 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'qywxsassEntityManagerFactory' of type [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [projectingArgumentResolverBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-11-28T17:59:41.912+08:00 WARN 18703 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'qywxsassEntityManagerFactory' of type [jdk.proxy2.$Proxy151] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [projectingArgumentResolverBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-11-28T17:59:41.922+08:00 WARN 18703 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'jpaMappingContext' of type [org.springframework.data.jpa.repository.config.JpaMetamodelMappingContextFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [projectingArgumentResolverBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-11-28T17:59:41.923+08:00 WARN 18703 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'jpaMappingContext' of type [org.springframework.data.jpa.mapping.JpaMetamodelMappingContext] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [projectingArgumentResolverBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-11-28T17:59:42.289+08:00 WARN 18703 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'blockRepository' of type [org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [projectingArgumentResolverBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-11-28T17:59:42.291+08:00 WARN 18703 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'blockRepository' of type [jdk.proxy2.$Proxy156] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [projectingArgumentResolverBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-11-28T17:59:42.298+08:00 WARN 18703 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'customMethodSecurityExpressionHandler' of type [com.kbnotebooks.qywx.config.CustomMethodSecurityExpressionHandler] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [projectingArgumentResolverBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-11-28T17:59:42.300+08:00 WARN 18703 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'methodSecurityConfig' of type [com.kbnotebooks.qywx.config.MethodSecurityConfig$$SpringCGLIB$$0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [projectingArgumentResolverBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
Comment From: wilkinsona
@billschen in that case, this is almost certainly a Spring Security problem. A complete yet minimal example will allow us to know for sure.
Comment From: billschen
I create a complete yet minimal example and test. then warn message out put when I use the deprecated springframework.security annotation like EnableGlobalMethodSecurity or GlobalMethodSecurityConfiguration
when upgrade to EnableMethodSecurity warn message gone. checker.zip
Comment From: wilkinsona
Thanks very much, @billschen. Please open a Spring Security issue so that they can investigate whether or not it makes sense to fix the implementation that backs the deprecated annotations to avoid the warnings.
Comment From: BenetatosG
This still happens when I use @EnableMethodSecurity
Comment From: wilkinsona
@BenetatosG the advice in https://github.com/spring-projects/spring-security/issues/14209 may still apply. If it does not help, please open a Spring Security issue.
Comment From: BenetatosG
@wilkinsona I will try that out, thank you for the quick reply!