org.springframework.beans.factory.UnsatisfiedDependencyException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Session scoped bean DefaultOAuth2ClientContext can't be created when it's constructor dependency request scoped AccessTokenRequest bean has parameters set We're trying to use Oauth2RestTemplate. We currently use the latest version of the spring-security-ouath2 - 1.0.0.m6d. The problem is that when OAuthRestTemplate is used for a first time - the session scoped DefaultOAuth2ClientContext bean is created successfully only if it's constructor dependency AccessTokenRequest request scoped bean doesn't have parameters set. But in our scenario we can pass access token request parameters (code, state) just right before OAuthRestTemplate is used for a first time. This issue is caused by the MapToMapConverter which just can't convert AccessTokenRequest proxy to the AccessTokenRequest interface constructor-arg of the DefaultOAuth2ClientContext class. As the MapToMapConverter tries to convert only when !sourceMap.isEmpty() that's why we only have this issue when AccessTokenRequest has request parameters set, Here is the stack trace: {noformat} org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'scopedTarget.org.springframework.security.oauth2.client.context.DefaultOAuth2ClientContext#0': Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.security.oauth2.client.token.AccessTokenRequest]: Could not convert constructor argument value of type [$Proxy244] to required type [org.springframework.security.oauth2.client.token.AccessTokenRequest]: Failed to convert value of type '$Proxy244 implementing org.springframework.security.oauth2.client.token.AccessTokenRequest,java.io.Serializable,org.springframework.aop.scope.ScopedObject,org.springframework.aop.framework.AopInfrastructureBean,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised' to required type 'org.springframework.security.oauth2.client.token.AccessTokenRequest'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type $Proxy244<?, ?> to type org.springframework.security.oauth2.client.token.AccessTokenRequest<java.lang.String, java.util.List<?>> for value 'org.springframework.security.oauth2.client.token.DefaultAccessTokenRequest@96ea788'; nested exception is java.lang.IllegalArgumentException: Unsupported Map interface: org.springframework.security.oauth2.client.token.AccessTokenRequest at org.springframework.beans.factory.support.ConstructorResolver.resolvePreparedArguments(ConstructorResolver.java:779) at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:131) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1035) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:927) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$2.getObject(AbstractBeanFactory.java:332) at org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:43) {noformat}
    via by Viktor Khoroshko,
  • Session scoped bean DefaultOAuth2ClientContext can't be created when it's constructor dependency request scoped AccessTokenRequest bean has parameters set We're trying to use Oauth2RestTemplate. We currently use the latest version of the spring-security-ouath2 - 1.0.0.m6d. The problem is that when OAuthRestTemplate is used for a first time - the session scoped DefaultOAuth2ClientContext bean is created successfully only if it's constructor dependency AccessTokenRequest request scoped bean doesn't have parameters set. But in our scenario we can pass access token request parameters (code, state) just right before OAuthRestTemplate is used for a first time. This issue is caused by the MapToMapConverter which just can't convert AccessTokenRequest proxy to the AccessTokenRequest interface constructor-arg of the DefaultOAuth2ClientContext class. As the MapToMapConverter tries to convert only when !sourceMap.isEmpty() that's why we only have this issue when AccessTokenRequest has request parameters set, Here is the stack trace: {noformat} org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'scopedTarget.org.springframework.security.oauth2.client.context.DefaultOAuth2ClientContext#0': Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.security.oauth2.client.token.AccessTokenRequest]: Could not convert constructor argument value of type [$Proxy244] to required type [org.springframework.security.oauth2.client.token.AccessTokenRequest]: Failed to convert value of type '$Proxy244 implementing org.springframework.security.oauth2.client.token.AccessTokenRequest,java.io.Serializable,org.springframework.aop.scope.ScopedObject,org.springframework.aop.framework.AopInfrastructureBean,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised' to required type 'org.springframework.security.oauth2.client.token.AccessTokenRequest'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type $Proxy244<?, ?> to type org.springframework.security.oauth2.client.token.AccessTokenRequest<java.lang.String, java.util.List<?>> for value 'org.springframework.security.oauth2.client.token.DefaultAccessTokenRequest@96ea788'; nested exception is java.lang.IllegalArgumentException: Unsupported Map interface: org.springframework.security.oauth2.client.token.AccessTokenRequest at org.springframework.beans.factory.support.ConstructorResolver.resolvePreparedArguments(ConstructorResolver.java:779) at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:131) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1035) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:927) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$2.getObject(AbstractBeanFactory.java:332) at org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:43) {noformat}
    via by Viktor Khoroshko,
  • Vraptor 3 + JPA
    via by Unknown author,
  • Vraptor 3 - Hibernate 4
    via by Unknown author,
  • Vraptor 3 - Hibernate 4 - Front-end - GUJ
    via by Unknown author,
    • org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'scopedTarget.org.springframework.security.oauth2.client.context.DefaultOAuth2ClientContext#0': Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.security.oauth2.client.token.AccessTokenRequest]: Could not convert constructor argument value of type [$Proxy244] to required type [org.springframework.security.oauth2.client.token.AccessTokenRequest]: Failed to convert value of type '$Proxy244 implementing org.springframework.security.oauth2.client.token.AccessTokenRequest,java.io.Serializable,org.springframework.aop.scope.ScopedObject,org.springframework.aop.framework.AopInfrastructureBean,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised' to required type 'org.springframework.security.oauth2.client.token.AccessTokenRequest'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type $Proxy244<?, ?> to type org.springframework.security.oauth2.client.token.AccessTokenRequest<java.lang.String, java.util.List<?>> for value 'org.springframework.security.oauth2.client.token.DefaultAccessTokenRequest@96ea788'; nested exception is java.lang.IllegalArgumentException: Unsupported Map interface: org.springframework.security.oauth2.client.token.AccessTokenRequest at org.springframework.beans.factory.support.ConstructorResolver.resolvePreparedArguments(ConstructorResolver.java:779) at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:131) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1035) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:927) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$2.getObject(AbstractBeanFactory.java:332) at org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:43)
    No Bugmate found.