Shiro
  1. Shiro
  2. SHIRO-352

Shiro annotations with @Component and getBean(Type)

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Not a Problem
    • Affects Version/s: 1.2.0
    • Fix Version/s: None
    • Component/s: Integration: Spring
    • Labels:
      None
    • Environment:
      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);

        Activity

        Matt Friedman made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Matt Friedman made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Not A Problem [ 8 ]
        Matt Friedman created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Matt Friedman
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development