Estoy usando vaadin con spring boot e intento incorporar la seguridad de spring, tomo un ejemplo y funciona correctamente con versiones anteriores de spring boot y de vaadin, pero al actualizar la versión, el mismo programa me da ese error. En mi proyecto tengo varios factores agregados que complican agregando variables, luego de mucho depurar me doy cuenta de que si el ejemplo que baje que funciona correctamente con la versión 1.5.4.RELEASE de spring boot al cambiarla a la version 2.0.2.RELEASE me da el siguiente error
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2018-05-28 21:45:30.700 ERROR 14282 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
APPLICATION FAILED TO START
Description:
Field authenticationManager in com.wordpress.kuylim.springbootvaadin.security.impl.SecurityImpl required a bean of type 'org.springframework.security.authentication.AuthenticationManager' that could not be found.
Action:
Consider defining a bean of type 'org.springframework.security.authentication.AuthenticationManager' in your configuration.
en la clase WebSecurityConfiguration tengo lo siguiente que como veran es un ejemplo básico como para poder hacer andar y colaborar todos los integrantes de la arquitectura sin problemas.
@Configuration @EnableWebSecurity public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth)
throws Exception {
auth.inMemoryAuthentication().withUser("user")
.password("123").roles("ADMIN");
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/THEME", "/VAADIN/**", "/PUSH/**", "/UIDL/**", "/login", "/error/**", "/accessDenied/**", "/vaadinServlet/**").permitAll()
.antMatchers("/admin").hasRole("ADMIN");
http.csrf().disable();
http.exceptionHandling().accessDeniedPage("/access-denied");
}
}
Obvio podria usar directamente esta version de spring boot, pero es posible o muy probable que eso me gener problemas en los otras partes del proyecto.
Este ejemplo lo baje de KUYLIM. (Lo pueden ver en https://github.com/kuylim/spring-boot-security-vaadin) y esta tal cual el lo genero, solo cambiando lo siguiente del pom
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
en lugar de lo que originalmente había
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
Desde ya muchas gracias a quien pueda darme un ejemplo de como resolver este problema
@EnableWebSecurity
por@EnableGlobalMethodSecurity(securedEnabled = true, prePostEnabled = true)
– Legna el 31 may. 18 a las 16:57