HTTP 405 with embedded VAADIN UI in a SPRING-BOOT JSP based webapp
<p>I have integrated Vaadin 7 embedding the UI, as explained in Vaadin Book, in some JSP pages of a Spring Boot based application. </p>

<p>Despite the UI named "v-my-vaadin-ui" is correctly displayed when I call the path in which it is embedded (through a spring MVC controller) I got an HTTP 405 error when interacting with the UI.</p>

<p>Error is on the URL:</p>

<blockquote>
  <p><a href="http://localhost:8080/v-my-vaadin-ui/UIDL/?v-uiId=4" rel="nofollow noreferrer">http://localhost:8080/v-my-vaadin-ui/UIDL/?v-uiId=4</a></p>
</blockquote>

<p>It seems that because in Spring Boot all controllers have only GET method allowed by default (POST has to be explicitly allowed as explained <a href="https://stackoverflow.com/questions/30171265/http-405-not-allowed-spring-boot-spring-security">here</a>) </p>

<p>Already tried disabling the CSRF and configuring Vaadin ralated paths in my Spring Security Configuration:</p>

<pre><code>http.authorizeRequests()
.antMatchers("/vaadinServlet/**", 
"/UIDL/**", 
"/v-my-vaadin-ui/UIDL/**", 
"/v-my-vaadin-ui/PUSH/**", 
"/HEARTBEAT/**", "/VAADIN/**").permitAll();
http.csrf().disable();
</code></pre>

<p>because VAADIN integration is requiring no CSRF managed by Spring but this doesn't solve the problem. </p>

<p>The VAADIN application is very basic:</p>

<pre><code>@SpringUI(path = "v-my-vaadin-ui")
public class MyVaadinUI extends UI {

    private static final long serialVersionUID = -8129815147461786549L;

    @Override
    protected void init(VaadinRequest vaadinRequest) {

        final TextField name = new TextField("Name");
        final Button greetButton = new Button("Greet");

        greetButton.addClickListener(new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                Notification.show("Hi " + name.getValue(), 
                                  Notification.Type.HUMANIZED_MESSAGE);
            }
        });

        VerticalLayout vl = new VerticalLayout(name, greetButton);
        vl.setSpacing(true);
        setContent(vl);
    }

}
</code></pre>

<p>But clicking on the Vaadin button the response code is 405 and the exception in detail is:</p>

<blockquote>
  <p>.w.s.m.a.ResponseStatusExceptionResolver : Resolving exception from handler [ResourceHttpRequestHandler [locations=[ServletContext resource [/], class path resource [META-INF/resources/], class path resource [resources/], class path resource [static/], class path resource [public/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@4a8756c3]]]: org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported</p>
</blockquote>

<p>Unfortunately I didn't find <strong>any way to configure the POST method</strong> for the UI as for a simple controller i.e. via </p>

<pre><code>@RequestMapping(method = {RequestMethod.GET, RequestMethod.POST})
</code></pre>

<p>because this annotation cannot be used for Vaadin UI.</p>

<p>Moreover if I call <strong>directly</strong> the UI (i.e. not passing through a Spring controller) with the URL:</p>

<blockquote>
  <p><a href="http://localhost:8080/v-my-vaadin-ui" rel="nofollow noreferrer">http://localhost:8080/v-my-vaadin-ui</a></p>
</blockquote>

<p>UI displays and works perfectly.</p>

<p>Any idea what is causing this problem? How can I allow the POST method?</p>