title: Parameter 0 of constructor required a bean of type that could not be found
body: <p>I want to have an SSO CAS Authentification, I've followed the instruction of the Bealdung's tutorial (<a href="https://www.baeldung.com/spring-security-cas-sso" rel="nofollow noreferrer">https://www.baeldung.com/spring-security-cas-sso</a> part 4) but when I run as spring boot app I've got this error</p>
  <blockquote>
  <p>Parameter 0 of constructor in SecurityConfig required a bean of type 'org.springframework.security.cas.authentication.CasAuthenticationProvider' that could not be found.</p>
  <p>Action:</p>
  <p>Consider defining a bean of type 'org.springframework.security.cas.authentication.CasAuthenticationProvider' in your configuration.</p>
  </blockquote>
  <p>I saw same issue here but with other spring's import and i've tried to add @Bean annotation but no more results</p>
  <pre class="lang-java prettyprint-override"><code>
  @EnableWebSecurity
  @Configuration
  public class SecurityConfig extends WebSecurityConfigurerAdapter {
   
      private AuthenticationProvider authenticationProvider;
      private AuthenticationEntryPoint authenticationEntryPoint;
      private SingleSignOutFilter singleSignOutFilter;
      private LogoutFilter logoutFilter;
   
      @Autowired
      public SecurityConfig(CasAuthenticationProvider casAuthenticationProvider, AuthenticationEntryPoint eP, LogoutFilter lF, SingleSignOutFilter ssF) {
          this.authenticationProvider = casAuthenticationProvider;
          this.authenticationEntryPoint = eP;
   
          this.logoutFilter = lF;
          this.singleSignOutFilter = ssF;
   
      }
       
      @Override
      protected void configure(HttpSecurity http) throws Exception {
        http
          .authorizeRequests()
          .regexMatchers(&quot;/secured.*&quot;, &quot;/login&quot;)
          .authenticated()
          .and()
          .authorizeRequests()
          .regexMatchers(&quot;/&quot;)
          .permitAll()
          .and()
          .httpBasic()
          .authenticationEntryPoint(authenticationEntryPoint);
      }
   
      @Override
      protected void configure(AuthenticationManagerBuilder auth) throws Exception {
        auth.authenticationProvider(authenticationProvider);
      }
   
      @Override
      protected AuthenticationManager authenticationManager() throws Exception {
        return new ProviderManager(Arrays.asList(authenticationProvider));
      }
   
      @Bean
      public CasAuthenticationFilter casAuthenticationFilter(ServiceProperties sP) throws Exception {
        CasAuthenticationFilter filter = new CasAuthenticationFilter();
        filter.setServiceProperties(sP);
        filter.setAuthenticationManager(authenticationManager());
        return filter;
      }
  }
  
  
  </code></pre>
  <p>It suppose to redirect to the secured login page (the cas server login page) but now I can't start the app.</p>
  <p>Thanks for your help</p>
  <p>EDIT : My CasAuthenticationProvider bean is in my CasSecuredAppApplication class like the tuto said</p>
  <pre class="lang-java prettyprint-override"><code>
  public class CasSecuredAppApplication {
      
      @Bean
      public ServiceProperties serviceProperties() {
          ServiceProperties serviceProperties = new ServiceProperties();
          serviceProperties.setService(&quot;http://xxx/&quot;);
          serviceProperties.setSendRenew(false);
          return serviceProperties;
      }
       
      @Bean
      @Primary
      public AuthenticationEntryPoint authenticationEntryPoint(
        ServiceProperties sP) {
        
          CasAuthenticationEntryPoint entryPoint
            = new CasAuthenticationEntryPoint();
          entryPoint.setLoginUrl(&quot;https://xxx/cas/login&quot;);
          entryPoint.setServiceProperties(sP);
          return entryPoint;
      }
       
      @Bean
      public TicketValidator ticketValidator() {
          return new Cas30ServiceTicketValidator(
            &quot;https:///cas&quot;);
      }
       
      @Bean
      public CasAuthenticationProvider casAuthenticationProvider() {
        
          CasAuthenticationProvider provider = new CasAuthenticationProvider();
          provider.setServiceProperties(serviceProperties());
          provider.setTicketValidator(ticketValidator());
          provider.setUserDetailsService(
            s -&gt; new User(&quot;casuser&quot;, &quot;Mellon&quot;, true, true, true, true,
              AuthorityUtils.createAuthorityList(&quot;ROLE_ADMIN&quot;)));
          provider.setKey(&quot;CAS_PROVIDER_LOCALHOST_8080&quot;);
          return provider;
      }
  
  }
  
  </code></pre>
  <p>It should be found by my SecurityConfig class no ?</p>