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

bean inject error while use shiro-spring-boot-web-starter

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.4.2
    • None
    • Configuration
    • None

    Description

      I got an error while integration shiro  with my spring boot project, I add a dependecy as follow:

      <dependency>
      <groupId>org.apache.shiro</groupId>
      <artifactId>shiro-spring-boot-web-starter</artifactId>
      <version>1.4.2</version>
      </dependency>

      After write some code and start the program, the error log appears:

       

      ***************************
       APPLICATION FAILED TO START
       ***************************
      Description:
      The bean 'competitionActivityMappingHandler' could not be injected as a 'com.garmin.gcc.manager.activitymapping.CompetitionActivityMappingHandler' because it is a JDK dynamic proxy that implements:
      Action:
      Consider injecting the bean as one of its interfaces or forcing the use of CGLib-based proxies by setting proxyTargetClass=true on @EnableAsync and/or @EnableCaching.
      

       

       

      CompetitionActivityMappingHandler is a class with Spring annotion Component, I tried add
      the following configuration in applicaation.yml:

      spring:
       aop:
       proxy-target-class: true
       auto: true

      but didn't work, did I miss any configuration?

       

      code:

       

      @Configuration
      public class PermissionManager {
      
          @Autowired
          private GsRealm gsRealm;
      
          @Bean
          public Realm realm() {
              return gsRealm;
          }
      
          @Bean
          public Authorizer authorizer() {
              return gsRealm;
          }
      
          @Bean
          public ShiroFilterChainDefinition shiroFilterChainDefinition() {
              DefaultShiroFilterChainDefinition chainDefinition = new DefaultShiroFilterChainDefinition();
              chainDefinition.addPathDefinition("/**", "authc"); // all paths are managed via annotations
      
              // or allow basic authentication, but NOT require it.
              // chainDefinition.addPathDefinition("/**", "authcBasic[permissive]");
              return chainDefinition;
          }
      
      }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            Phil Zhang Phil Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: