Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Not A Problem
-
1.2.0
-
None
-
None
-
Linux, Spring, Java
Description
I have a bean where I'd like to annotate one of the methods with the @RequiresAuthentication annotation.
When using the @RequiresAuthentication annotation and calling applicationContext.getBean(Class<?>) spring does not find my bean. Commenting out @RequiresAuthentication allows spring to find the bean.
Using the string name of the bean instead of the type (i.e. applicationContext.getBean(String)) does work.
// this causes spring to be unable to find the bean when using @RequiresAuthentication
Class<? extends Processor> processorType = command.getProcessorType();
Processor processor = applicationContext.getBean(processorType);
// However this works:
Processor processor = applicationContext.getBean(processorStringName);