Hi all. I’m trying to integrate spring into my application, I’ve done a lot of research and read, but I haven’t found any solution that’s simple and works nicely. When using SpringApplicationServlet, it looks like dependency injection will only happen on the main Application class.
If the main application class creates its own instances of forms/panels, etc… these won’t be managed by spring and thus I can’t use D.I (i.e @Autowired, etc…), unless I use aspectj, which is something I’d preffer not to use.
I’ve even found
here
a very clean setup, but It’s entirely based on compile-time-weaving using Aspectj, which I don’t want to use (too much black magic for me).
So, please correct me if I’m wrong, I only have two posibilities left:
- Stay with SpringApplicationServlet, and have all my components be managed by spring. Thus I should not be writing things like
layout.setContent(new SMSPanel());
But SMSPanel should be an instance member injected by spring.
-
Do it even easier, and use the Spring Helper class. Is there any “improved” helper class that has an static method to retrieve a spring bean? The problem with the current one in the Wiki is that it needs to be instantiated with the application reference in the constructor (thus I’ll be required to pass the application reference all over the place).
-
Forget about spring. It provided a lot in conjunction with spring mvc, but now I only need it for DI and the data access layer. I’ve spent more time trying to integrate Spring with Vaadin than learing Vaadin alone. But Spring JDBCTemplate and Hibernate support are nice. Suggestions?