You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shiro.apache.org by "Phil Zhang (Jira)" <ji...@apache.org> on 2019/12/13 06:15:00 UTC

[jira] [Created] (SHIRO-733) bean inject error while use shiro-spring-boot-web-starter

Phil Zhang created SHIRO-733:
--------------------------------

             Summary: bean inject error while use shiro-spring-boot-web-starter
                 Key: SHIRO-733
                 URL: https://issues.apache.org/jira/browse/SHIRO-733
             Project: Shiro
          Issue Type: Bug
          Components: Configuration
    Affects Versions: 1.4.2
            Reporter: Phil Zhang


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:

 
{noformat}
***************************
 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.
{noformat}
 

 

CompetitionActivityMappingHandler is a class with Spring annotion Component, I tried add
 the following configuration in applicaation.yml:
{code:java}
spring:
 aop:
 proxy-target-class: true
 auto: true{code}

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

 

code:

 
{code:java}
@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;
    }

}
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)