Reputation: 33
I have a pretty basic vaadin application running. The application is spring-boot backed and I defined some rest API.
I've added OpenAPI documentation using org.springdoc:springdoc-openapi-ui:1.4.4, which worked perfectly before adding vaadin.
After adding the vaadin dependencies as shown in the vaadin spring-boot tutorial, and creating a view (which works), the swagger UI is no longer reachable.
It seems to me that vaadin completely takes over all web requests. Digging deeper, I've found that vaadin registers a new servlet and catches all requests.
I don't find any docs on how to configure this -- I'd expect that one could configure vaadin such that it serves UI from a different path, say /ui
or similar.
I've tried to set
vaadin:
url-mapping: "/ui/*"
in my application.yaml
-- but this results in blank pages (no errors) for my vaadin views,
and the vaadin servlet does still take over /
.
I use spring.boot 2.3.2.RELEASE
, vaadin 14.3.1
.
Upvotes: 3
Views: 1237
Reputation: 37008
The value to override is (note the camelCase instead of the kebab-case):
vaadin:
urlMapping: /ui/*
Using the kebab-case did (does) not work. As expected, this is a bug. See https://github.com/vaadin/spring/issues/637
From the docs at the point of time:
You can set properties for Spring Boot in your
application.properties
file.Example: Setting Spring URL mapping in
application.properties
.vaadin.urlMapping=/my_mapping/*
By default, URL mapping is
/*
.An additional servlet, such as
/my_mapping/*
, is required to handle the frontend resources for non-root servlets. The servlet can be defined in your application class. See this Application class for a example.
Upvotes: 3