SpringNavigator with History Extension

Hi guys,
I’m trying to use the history extension in my Spring/Vaadin project (using vaadin-spring-1.1.1) but I fail miserably… As I understand it from this example:


https://github.com/wolfie/HistoryExtension/blob/master/src/test/java/com/github/wolfie/history/navigatordemo/NavigatorUI.java

I should provide a NavigationStateManager to the (Spring-)Navigator. So, I try to create a Spring bean using one of the ctors in SpringNavigator accepting a NavigationStateManager. This ctor in turn delegates to the super ctor which in turn calls init(). The init method is then overridden in SpringNavigator and from there a call to addProvider is made and a IllegalArgument is thrown.

So, my question is: how do I create a SpringNavigator with a ‘custom’ NavigationStateManager w/Sithout running into this problem. Since the ViewProvider is autowired by field I can’t really set it before the init method is called.

I’m on vaadin-server-7.7.5.

br
/Svante

Does something like this in UI.init() work.

SpringNavigator navigator = appContext.getBean(SpringNavigator.class, myUI, pushStateManager,  myViewDisplay);
setNavigator(navigator)

Hi and thanks for answering!
But no, it doesn’t work. The SpringNavigator is already created with the default ctor by the VaadinAutoConfiguration and that’s the instance I get back from the appContext.getBean(…).
I have probably missed something but when I look at the SpringNavigator I don’t see how it could ever work using the ctor which takes a NavigationStateManager as param since addProvider(null) will be called.
If only the SpringNavigator provided a ctor which also had the ViewProvider as param…

Ah of course it doesn’t work. Sorry.

No problems :slight_smile: