java - Error creating bean with name 'securityConfig': Injection of autowired dependencies failed -


I am trying to combine Java-config and XML-config for Spring Protection Authentication. But I got an error:

Error creating a bean with name 'Security Config': Injection of autowired dependencies failed

What's the problem with my code? Got googling for the answer but have not got any

Thanks in advance Hope you can help me.

Stack-trace:

  org.springframework.beans.factory.BeanCreationException: Configure the name 'Error creating a bean with security': Injection of Autowall dependency failed; Nested exception org.springframework.beans.factory.BeanCreationException: The method can not be autowire: Public Zero org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter.setAuthenticationConfiguration (org.springframework.security.config.annotation. Authentication configuration.AuthenticationConfiguration); Nested exception org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean type [org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration] found for dependency: at least 1 bean of hope that the autowire candidate This dependent depends on Dependency Annotation: {}: org.springframework.beans.factory.BeanCreationException: The method can not be autowire: Public Zero org.springframework.security.config.annotation.web.configuration .websecurityconfiguration .configuration.AuthenticationConfiguration); Nested exception org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean type [org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration] found for dependency: at least 1 bean of hope that the autowire candidate This dependent depends on Dependency Annotation: {}: org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean type [org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration] Dependence Found for: At least 1 bean expected this Entry dependent as autowire candidate for filling annotation: {}   

java-config: securityconfig.java

  @configuration @ EnableWebMvc security public class security Configure WebSecTive Configure Adapter Extends {@ Override Protected Zero Configure (HTTP Security) http) exception {http .authorizeRequests () .antMatchers ("/ webapp / resources / **"). PermitAll () .anyRequest () Authenticated () .and () .formLogin () .loginPage ("/ login") .permitAll () .and () .logout () .permitAll (); } @Autoward Public Wide Register Global Authentication (Authentication Manager Account) Exception {auth .memoryAuthentication () .withUser ("Users") returns. Password ("password"). Roles ("user"); }}   

web.xml

  & lt ;! - The definition of all spring containers shared by all Servlets and filters - & gt; & Lt; Context param & gt; & Lt; Ultimate Name & gt; ContextConfigLocation & lt; / Lastname & gt; & Lt; Ultimate Price & gt; /WEB-INF/spring/root-context.xml< / Super-valued & gt; & Lt; / Reference param & gt; & Lt ;! - Creates shared spring containers by all Servlets and Filters - & gt; & Lt; Listener & gt; & Lt; Audience category & gt; Org.springframework.web.context.ContextLoaderListener & lt; / Listener Category & gt; & Lt; / Listener & gt; & Lt ;! - Procedures for application requests - & gt; & Lt; Servlet & gt; & Lt; Servlet-name & gt; appServlet & lt; / Servlet-name & gt; & Lt; Servlet category & gt; org.springframework.web.servlet.DispatcherServlet & lt; / Servlet category & gt; & Lt; Init-param & gt; & Lt; Ultimate Name & gt; ContextConfigLocation & lt; / Lastname & gt; & Lt; Ultimate Price & gt; /WEB-INF/spring/appServlet/servlet-context.xml< / Super-valued & gt; & Lt; / Init-param & gt; & Lt; Load-On-Startup & gt; 1 & lt; / Load-on-startup & gt; & Lt; / Servlet & gt; & Lt; Servlet-mapping & gt; & Lt; Servlet-name & gt; appServlet & lt; / Servlet-name & gt; & Lt; URL pattern & gt; / & Lt; / URL pattern & gt; & Lt; / Servlet-mapping & gt;   

I have already announced component-scanning in my servlet-context.xml

      

You can try to add @Component annotation Are there. Vehicles like this should work.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -