You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shiro.apache.org by "Gaurav Raj (Jira)" <ji...@apache.org> on 2020/08/20 11:29:00 UTC

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

    [ https://issues.apache.org/jira/browse/SHIRO-733?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17181117#comment-17181117 ] 

Gaurav Raj commented on SHIRO-733:
----------------------------------

Even I'm facing the same issue. 

This is my entire list of dependencies - 

{{dependencies {}}
{{ compile project(':client')}}

{{ implementation 'org.springframework.boot:spring-boot-starter-web'}}
{{ runtimeOnly 'mysql:mysql-connector-java'}}
{{ compileOnly 'org.projectlombok:lombok:1.18.10'}}
{{ annotationProcessor 'org.projectlombok:lombok:1.18.10'}}
{{ testImplementation 'org.springframework.boot:spring-boot-starter-test'}}
{{ implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'}}
{{ compile group: 'in.zapr.druid', name: 'vorta-druidry', version: '3.1.9'}}
{{ compile 'org.springframework:spring-context-support:4.1.4.RELEASE'}}
{{ compile 'net.sf.ehcache:ehcache:2.9.0'}}
{{ implementation 'com.google.code.gson:gson:2.8.6'}}
{{ compile group: 'com.opencsv', name: 'opencsv', version: '4.1'}}
{{ compile group: 'javax.persistence', name: 'persistence-api', version: '1.0'}}
{{ compile group: 'com.microsoft.azure', name: 'azure-storage', version: '8.6.0'}}
{{ compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-openfeign', version: '2.2.1.RELEASE'}}
{{ compile group: 'org.reflections', name: 'reflections', version: '0.9.9'}}
{{ compile group: 'net.rakugakibox.spring.boot', name: 'logback-access-spring-boot-starter', version: '2.7.1' // For access Logs}}
{{ compile group: 'org.springframework.boot', name: 'spring-boot-starter-aop', version: '2.3.0.RELEASE' //spring boot AOP}}
{{ compile group: 'io.springfox', name: 'springfox-swagger2', version: '2.9.2'}}
{{ compile group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.9.2'}}

{{ compile group: 'org.springframework.boot', name: 'spring-boot-starter-actuator', version: '2.2.1.RELEASE'}}
{{ compile group: 'io.micrometer', name: 'micrometer-core', version: '1.5.1'}}
{{ compile group: 'io.micrometer', name: 'micrometer-registry-prometheus', version: '1.5.1'}}
{{ compile group: 'org.json', name: 'json', version: '20190722'}}
{{ compile group: 'redis.clients', name: 'jedis', version: '3.3.0'}}
{{ compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-redis', version: '2.3.0.RELEASE'}}
{{ compile group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.10.0'}}
{{ compile 'org.apache.shiro:shiro-spring-boot-web-starter:1.5.3'}}
{{}}}

> 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
>            Priority: Major
>
> 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)