Thanks Ray's response very much. Finally, I got this to work after I added
AutowiredTestService
to org.springframework.boot.autoconfigure.AutoConfiguration.imports.
On Tuesday, January 24, 2023 at 1:18:54 AM UTC+8 Ray Bon wrote:
> Thomas,
>
> What is it that you are trying to do?
>
> The capability may already exist.
>
> If the problem is related to test classes, you may have to import
> packages. For example, I have:
>
> testCompileOnly "org.apereo.cas:cas-server-core-webflow-api"
> testImplementation "org.apereo.cas:cas-server-core-services-authentication"
>
> The war file pulled in with war-overlay does not include test artifacts.
>
> Ray
>
> On Sat, 2023-01-21 at 18:58 -0800, Thomas Tong wrote:
>
> Notice: This message was sent from outside the University of Victoria
> email system. Please be cautious with links and sensitive information.
>
>
> Hi, everyone
> I'm new developer to CAS. I downloaded CAS7.0.0.RC3 with CAS
> Initliazr to test. I defined a AutowiredTestService.java as below.
>
> package org.apereo.cas.config;
> import org.springframework.stereotype.Service;
>
> @Service
> public class AutowiredTestService {
> public AutowiredTestService(){
> System.out.println("AutowiredTestService is constructed....");
> }
> }
>
> But Idea reports "Could not autowire" when I tried to Autowired this
> service in Autowired annotation.
>
> package org.apereo.cas.config;
>
> import org.springframework.beans.factory.annotation.Autowired;
> import org.springframework.boot.autoconfigure.AutoConfiguration;
>
> @AutoConfiguration
> //@EnableConfigurationProperties(CasConfigurationProperties.class)
> public class CasOverlayOverrideConfiguration {
> @Autowired
> public AutowiredTestService autowiredTestService;
>
> }
>
> And after I tried to run CAS in tomcat, following error is reported out.
> Caused by:
> org.springframework.beans.factory.UnsatisfiedDependencyException: Error
> creating bean with name
> 'org.apereo.cas.config.CasOverlayOverrideConfiguration': Unsatisfied
> dependency expressed through field 'autowiredTestService': No qualifying
> bean of type 'org.apereo.cas.config.AutowiredTestService' available:
> expected at least 1 bean which qualifies as autowire candidate. Dependency
> annotations:
> {@org.springframework.beans.factory.annotation.Autowired(required=true)}
>
> Would you like to let me know how to fix it? Thank you very much.
>
>
--
- 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 [email protected].
To view this discussion on the web visit
https://groups.google.com/a/apereo.org/d/msgid/cas-user/b4121ace-e0da-4a77-988d-f117d42fb58dn%40apereo.org.