Hi,

This is a big strange, defining a bean is one of the simplest thing in 
Spring Boot projects, but I seem to have problem in CAS 5.3.3 overlay.

I defined the following configuration class, specified in 
META-INF/spring.factories.  The UrlHandlerMapping works, as I can see code 
stops there as I debug.  But the one on MyUtility is never called, 
therefore, when I try to do @autowired elsewhere, it cannot find the 
"MyUtility" bean. 

Caused by: 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'scopedTarget.confirmEmailAddressAction': 
Unsatisfied
 dependency expressed through field 'myUtility'; nested exception is 
org.springframework.beans.factory.NoSuchBeanDefinitionException: No 
qualifying bean of typ
e 'org.apereo.cas.web.flow.login.MyUtility' available: expected at least 1 
bean which qualifies as autowire candidate. Dependency annotations: 
{@org.springfram
ework.beans.factory.annotation.Autowired(required=true)}
        at 
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.j
ava:588)
        at 
org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
        at 
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java
:366)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1269)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:551)

What am i missing?

Yan

@Configuration("CollaborationConfiguration")
public class CollaborationConfiguration {

    @Bean
    public SimpleUrlHandlerMapping handlerMapping() {
        final SimpleUrlHandlerMapping simpleUrlHandlerMapping = new 
SimpleUrlHandlerMapping();

        Map<String, Object> urlMap = new HashMap<>();
        urlMap.put("/updatepassword", collaboration());
        simpleUrlHandlerMapping.setUrlMap(urlMap);
         
        return simpleUrlHandlerMapping;
    }
    
    @Bean
    public CollaborationController collaboration() {
        return new CollaborationController();
    }

    @Bean
    public MyUtility utility() {
    return new MyUtility();
    }
    
}

-- 
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
--- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cas-user+unsubscr...@apereo.org.
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/33f8e1f8-dc16-4d54-add3-8f06d491700d%40apereo.org.

Reply via email to