Trying this https://vaadin.com/docs/v10/flow/spring/tutorial-spring-routing.html
dataBean == null all the time. Though it gets properly injected via contructor parameter.
Am I missing something or it is the only way of injecting dependency into @Route component?
I wonder if that example is just wrong. Fields are autowired after the constructor has been called, so you should have a @PostConstruct
method if you want to access the fields. Alternatively you should add the values as @Autowired
constructor parameters
Thanks for clarification. Is it a good way to init content in onAttach() method having all dependencies already injected into fields?
onAttach
should be fine
Thanks!