berndhopp / guice

guice-integration for the vaadin-framework
https://vaadin.com/directory#!addon/guice-vaadin-integration
10 stars 7 forks source link

Feature request: Support Route annotation type rather than defining extension of UI #14

Closed slovelo closed 6 years ago

slovelo commented 6 years ago

Since Vaadin 10, the need to extend the UI class to enter an application has been substituted in favour of the the Router (Route annotation).

To quote the Vaadin documentation

Most things you have previously done in the UI class, can be achieved in alternative, better ways.

I would like to request a new mechanism, to complement the existing UI code, where the Guice Servlet is able to locate and dependency inject Routes without having to define a UI as a single initial entry point. The use of Routes also allows us to easily define multiple URL entry points easily using Vaadin 10 semantics.

Many thanks. If this capability already exists, please correct me via the comments below.

berndhopp commented 6 years ago

In Vaadin 10, the Route-annotation replaces the SpringView and GuiceView-Annotations and it will work out-of-the-box if you have a GuiceVaadinServlet in place. So if you have a Vaadin 10-app, just change your servlet to subclass GuiceVaadinServlet and the routes will work 'as-is'.

best

slovelo commented 6 years ago

Thanks for the advice @berndhopp. I'll give that a try