Spring integration suggestions

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:

  1. 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.

  1. 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).

  2. 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?

Hello,

I’m trying to integrate Vaadin and Spring Social. Does anyone try to do this before? Any suggestion? I’m completely newbie to Vaadin and Spring.

Thanks a lot!

Nathalia

I had a pretty smooth experience integrating Spring and Vaadin in developing ExpressUI and the sample app.

You can find out more at
www.brownbagconsulting.com
.

The code tutorial shows the use of some Spring annotations, and then you can follow the download link to GitHub, if you want to drill into the code in more depth.

I didn’t have any issues adding Spring annotations to my beans. In some cases, I would subclass a regular Vaadin component or CustomComponent. I also provide a cool way of injecting Spring beans into non-bean JPA entities, which may also help you.

Anyway, I’m not exactly sure what issues you are having. Take a look at my code and feel free to followup with more detailed questions.

Juan