Uploaded image for project: 'Shiro'
  1. Shiro
  2. SHIRO-352

Shiro annotations with @Component and getBean(Type)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 1.2.0
    • None
    • Integration: Spring
    • 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);

      Attachments

        Activity

          People

            Unassigned Unassigned
            mfriedman Matt Friedman
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: