Issue
I have a configuration bean:
@Configuration
@ConfigurationProperties(prefix = "core.organizations")
public class PermissionConfig {
...
}
I want to get its real class. If I get it by method bean.getClass()
, I will get CGlib proxy instead.
I have tried using AopUtils.getTargetClass(bean)
, AopProxyUtils.ultimateTargetClass(bean)
, but it returns same proxy
Solution
You can use ClassUtils.getUserClass(Object bean) to get parent class of the CGLIB-generated subclass.
Answered By - Alexander Katsenelenbogen