{"action":"closed","issue":{"url":"https://api.github.com/repos/spring-cloud/spring-cloud-security/issues/47","labels_url":"https://api.github.com/repos/spring-cloud/spring-cloud-security/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/spring-cloud/spring-cloud-security/issues/47/comments","events_url":"https://api.github.com/repos/spring-cloud/spring-cloud-security/issues/47/events","html_url":"https://github.com/spring-cloud/spring-cloud-security/issues/47","id":60844660,"number":47,"title":"Apparent bean wiring paradox in `@ConfigurationProperties` objects for SSO","user":{"login":"jghiloni","id":1834264,"avatar_url":"https://avatars.githubusercontent.com/u/1834264?v=3","gravatar_id":"","url":"https://api.github.com/users/jghiloni","html_url":"https://github.com/jghiloni","followers_url":"https://api.github.com/users/jghiloni/followers","following_url":"https://api.github.com/users/jghiloni/following{/other_user}","gists_url":"https://api.github.com/users/jghiloni/gists{/gist_id}","starred_url":"https://api.github.com/users/jghiloni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jghiloni/subscriptions","organizations_url":"https://api.github.com/users/jghiloni/orgs","repos_url":"https://api.github.com/users/jghiloni/repos","events_url":"https://api.github.com/users/jghiloni/events{/privacy}","received_events_url":"https://api.github.com/users/jghiloni/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-12T16:12:53Z","updated_at":"2015-03-12T16:23:17Z","closed_at":"2015-03-12T16:23:17Z","body":"We've built a library to use spring-cloud-security to provide SSO to our developers behind an abstraction layer (in case, for example, the powers that be decide they don't want to use OAuth2). I upgraded the dependencies yesterday from 1.0.0.M3 to 1.0.0.RELEASE and now I'm seeing quite the odd paradox in one situation.\r\n\r\nWhen I try to start my app, which has `@EnableResourceServer` present, I get an exception that `ResourceServerProperties.Jwt.keyUri` is null, even though I can see in the logs that it's being loaded from my properties file. When I add `@EnableConfigurationProperties({ResourceServerProperties.class})` to one of my configuration classes to enable the bean, I then get an error that it can't create the bean, because it's missing a constructor argument of type String.\r\n\r\nException when `@EnableConfigurationProperties` is missing:\r\n```\r\n2015-03-12T10:12:03.09-0600 [App/0]   OUT Caused by: java.lang.IllegalArgumentException: 'uriTemplate' must not be null\r\n2015-03-12T10:12:03.09-0600 [App/0]   OUT       at org.springframework.util.Assert.hasText(Assert.java:162)\r\n2015-03-12T10:12:03.09-0600 [App/0]   OUT       at org.springframework.web.util.UriTemplate$Parser.<init>(UriTemplate.java:179)\r\n2015-03-12T10:12:03.09-0600 [App/0]   OUT       at org.springframework.web.util.UriTemplate$Parser.<init>(UriTemplate.java:172)\r\n2015-03-12T10:12:03.09-0600 [App/0]   OUT       at org.springframework.web.util.UriTemplate.<init>(UriTemplate.java:65)\r\n2015-03-12T10:12:03.09-0600 [App/0]   OUT       at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:528)\r\n2015-03-12T10:12:03.09-0600 [App/0]   OUT       at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:236)\r\n2015-03-12T10:12:03.09-0600 [App/0]   OUT       at org.springframework.cloud.security.oauth2.resource.ResourceServerTokenServicesConfiguration$JwtTokenServicesConfiguration.jwtTokenEnhancer(ResourceServerTokenServicesConfiguration.java:247)\r\n2015-03-12T10:12:03.09-0600 [App/0]   OUT       at org.springframework.cloud.security.oauth2.resource.ResourceServerTokenServicesConfiguration$JwtTokenServicesConfiguration$$EnhancerBySpringCGLIB$$6c1b5783.CGLIB$jwtTokenEnhancer$2(<generated>)\r\n2015-03-12T10:12:03.09-0600 [App/0]   OUT       at org.springframework.cloud.security.oauth2.resource.ResourceServerTokenServicesConfiguration$JwtTokenServicesConfiguration$$EnhancerBySpringCGLIB$$6c1b5783$$FastClassBySpringCGLIB$$d4ad3e27.invoke(<generated>)\r\n2015-03-12T10:12:03.09-0600 [App/0]   OUT       at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)\r\n2015-03-12T10:12:03.09-0600 [App/0]   OUT       at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:309)\r\n2015-03-12T10:12:03.09-0600 [App/0]   OUT       at org.springframework.cloud.security.oauth2.resource.ResourceServerTokenServicesConfiguration$JwtTokenServicesConfiguration$$EnhancerBySpringCGLIB$$6c1b5783.jwtTokenEnhancer(<generated>)\r\n2015-03-12T10:12:03.09-0600 [App/0]   OUT       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n2015-03-12T10:12:03.09-0600 [App/0]   OUT       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\n2015-03-12T10:12:03.09-0600 [App/0]   OUT       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n2015-03-12T10:12:03.09-0600 [App/0]   OUT       at java.lang.reflect.Method.invoke(Method.java:483)\r\n2015-03-12T10:12:03.09-0600 [App/0]   OUT       at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)\r\n2015-03-12T10:12:03.09-0600 [App/0]   OUT       ... 91 more\r\n```\r\n\r\nException when `@EnableConfigurationProperties` is present:\r\n```\r\n2015-03-12T10:07:43.99-0600 [App/0]   OUT Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cloud.security.oauth2.resource.ResourceServerTokenServicesConfiguration$JwtTokenServicesConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.cloud.security.oauth2.resource.ResourceServerProperties org.springframework.cloud.security.oauth2.resource.ResourceServerTokenServicesConfiguration$JwtTokenServicesConfiguration.resource; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'spring.oauth2.resource.CONFIGURATION_PROPERTIES': Unsatisfied dependency expressed through constructor argument with index 0 of type [java.lang.String]: : No qualifying bean of type [java.lang.String] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [java.lang.String] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}\r\n2015-03-12T10:07:43.99-0600 [App/0]   OUT   at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)\r\n2015-03-12T10:07:43.99-0600 [App/0]   OUT   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1202)\r\n2015-03-12T10:07:43.99-0600 [App/0]   OUT   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)\r\n2015-03-12T10:07:43.99-0600 [App/0]   OUT   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)\r\n2015-03-12T10:07:43.99-0600 [App/0]   OUT   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)\r\n2015-03-12T10:07:43.99-0600 [App/0]   OUT   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)\r\n2015-03-12T10:07:43.99-0600 [App/0]   OUT   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)\r\n2015-03-12T10:07:43.99-0600 [App/0]   OUT   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)\r\n2015-03-12T10:07:43.99-0600 [App/0]   OUT   at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:368)\r\n2015-03-12T10:07:43.99-0600 [App/0]   OUT   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1111)\r\n2015-03-12T10:07:43.99-0600 [App/0]   OUT   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1006)\r\n2015-03-12T10:07:43.99-0600 [App/0]   OUT   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)\r\n2015-03-12T10:07:43.99-0600 [App/0]   OUT   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)\r\n2015-03-12T10:07:43.99-0600 [App/0]   OUT   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)\r\n2015-03-12T10:07:43.99-0600 [App/0]   OUT   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)\r\n2015-03-12T10:07:43.99-0600 [App/0]   OUT   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)\r\n2015-03-12T10:07:43.99-0600 [App/0]   OUT   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)\r\n2015-03-12T10:07:43.99-0600 [App/0]   OUT   at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1120)\r\n2015-03-12T10:07:43.99-0600 [App/0]   OUT   at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1044)\r\n2015-03-12T10:07:43.99-0600 [App/0]   OUT   at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)\r\n2015-03-12T10:07:43.99-0600 [App/0]   OUT   at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:533)\r\n2015-03-12T10:07:43.99-0600 [App/0]   OUT   ... 56 more\r\n```\r\n\r\nAny thoughts on what changed between M3 and RELEASE that could have caused this? Thanks!"}}