samedi 28 mars 2015

@Autowiring give compilation error

I am trying to implement Spring security.I have created following test class for that



import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.*;
import org.springframework.security.config.annotation.authentication.builders.*;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.*;

@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER");
}
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.anyRequest().authenticated() ;

http.formLogin().loginPage("/auth/login").permitAll();
}


Following peace of code gives me compilation error.


@Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {


It Says Could not Autowire .No Bean of AuthenticationManagerBuilder Found .


I have followed http://ift.tt/1xK8KP3 tutorial. Please pin Point where i am wrong .


Aucun commentaire:

Enregistrer un commentaire