Vaadin4Spring - service implementation problem

Hi All,

I have finally time to test Vaadin 7 (as the company I work for is still using 6.8.9 for various reasons) and
tried the Vaadin4Spring integration. WOW ! Finally a good spring integration solution.

I am having problem however in defining my own simple service.

My application configuration part starts with:

@ComponentScan(value={“”, “”})
public class Application extends SpringBootServletInitializer

I have defined my service as:


public class MyService …

Then in my view definition I have:

public class MainView extends VerticalLayout implements View {

private J2EEConnectionPool connectionPool;
private MyService myService;

And here is the problem:

  • autowired connectionPool is just fine and its bean definition is provided in Application class using:

public J2EEConnectionPool connectionPool() {
J2EEConnectionPool connectionPool = new J2EEConnectionPool(dataSource());
return connectionPool;

and it works just fine. However MyService cannot be autowired - it complains that it cannot find it at all.
I tried to put the service definition in Application class as Bean definition as well - but that only results
in logs saying

“Skipping bean definition for [BeanMethod:name=categoryService,declaringClass=org.adrian.bookmarks.core.Application]
: a definition for bean ‘categoryService’ already exists. This top-level bean definition is considered as an override.”

I am quite new to Spring Boot so I am sure I am making somwhere a mistake …

Could anybody point me where the problem lies ?



Just coming back to say that I found what the problem was …

The service class is using @Transactional and two things:

  1. I have not provided @Bean in application for the transaction manager instance
  2. I left the default @EnableTransactionManagement which is normally using proxy mode.
    Changed to mode=AdviceMode.ASPECTJ and all like magic started working :wink:

Cheers to myself ! :stuck_out_tongue: