title: Vaadin 22 with Spring MVC and Spring Security
body: <p>I am trying to get a basic Vaadin22 app running with Spring MVC and Spring Security. The <a href="https://vaadin.com/docs/v22/flow/integrations/spring/view-based-access-control" rel="nofollow noreferrer">vaadin docs</a> seem to allude that this is possible,</p>
  <blockquote>
  <p>If an application is based on Spring Boot, this mechanism can be enabled by using a set of annotations and with minimum Spring Security configurations. However, it is also possible to use it in Vaadin Spring applications that are not based on Spring Boot, with some extra configurations.</p>
  </blockquote>
  <p>I have started with <a href="https://github.com/vaadin/skeleton-starter-flow/tree/v22" rel="nofollow noreferrer">skeleton-starter-flow v22</a>, forked to <a href="https://github.com/smillied/skeleton-starter-flow" rel="nofollow noreferrer">here</a> and added basic Spring integration (see <a href="https://github.com/smillied/skeleton-starter-flow/commit/b30c2ed4924cdd9db709da0b2739dd9395408ebe" rel="nofollow noreferrer">here</a>). I have then attempted to add Spring Security.</p>
  <p>I initially extended Vaadin's VaadinWebSecurityConfigurerAdapter (see <a href="https://github.com/smillied/skeleton-starter-flow/commit/cd5781b06b75954bb291c3b867270d6642a86cc2" rel="nofollow noreferrer">here</a>), but when I run the app it fails because there are missing autowired dependencies.</p>
  <p>Next, I forced some component scanning to detect the missing dependencies (see <a href="https://github.com/smillied/skeleton-starter-flow/commit/38345e8b409c572b7b6436c10e55a3fb497e024c" rel="nofollow noreferrer">here</a>), but now there is a ClassNotFoundException because there is a dependency on the Spring Boot class, ServletRegistrationBean</p>
  <p>Finally, I abandoned Vaadin's VaadinWebSecurityConfigurerAdapter and instead extended Spring's WebSecurityConfigurerAdapter (see <a href="https://github.com/smillied/skeleton-starter-flow/commit/ec535f25b5e215291dcbd32ab92a965d1db720c7" rel="nofollow noreferrer">here</a>). Now the app runs, but I am not seeing the default login screen that Spring is supposed to provide by default.</p>
  <p>Any assistance greatly appreciated.</p>
  <p>Note: The app can be run using,</p>
  <pre><code>mvn jetty:run
  </code></pre>