I’m trying Vaadin with Spring Boot, and created a project using http://start.spring.io, and followed the steps depicted there!
After loading it into IntelliJ 15.0.3 and running it I get the following error:
[code]
…
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at com.example.DemoApplication.main(DemoApplication.java:10) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_95]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_95]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_95]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_95]
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) [idea_rt.jar:na]
Caused by: java.lang.IllegalArgumentException: @ConditionalOnMissingBean annotations must specify at least one bean (type, name or annotation)
at org.springframework.util.Assert.isTrue(Assert.java:68) ~[spring-core-4.2.5.RELEASE.jar:4.2.5.RELEASE]
…
[/code]Anybody any idea why this error occurs, and how to tackle it!
It’s a very basic application, you find it attached! Thanks for trying to help!
By the way when I run the application by entering
mvn spring-boot:run at the command line it runs without problems and can access it via http://localhost:8080/
Regards,
Gerard[quote=Alejandro Duarte]
Thanks for the files, but… any chance that you can attach the whole project (as a ZIP file) so that I can compile it and run it?
[/quote] 23434.zip (96.7 KB)
Hi, it works for me when using
Run ‘demo’ . If I keep the
spring-boot-starter-tomcat dependency, then I get the error. So, I would suggest to remove that dependency, run
mvn clean install , and then,
Run ‘demo’ .
I still have the ServletInitializer class, and removed the dependency!
Now it works, but I don’t understand what is going on! Could you explain this to me?
The
spring-boot-starter-tomcat dependency is included by default when you inherit
spring-boot-starter-parent .
The
pom.xml you attached, explicitly included the
spring-boot-starter-tomcat dependency with a slight difference: You specified the
provided scope. This scope means that the dependency is to be provided by the JDK or server. So, you can compile of course, but you will run into errors when starting the application as this dependency won’t be in the classpath at run time.
Moreover, your application should also run if you keep the
spring-boot-starter-tomcat dependency but remove the
provided part.
I think I have to dig a bit deeper into spring-boot to be able to better understand what is going on behind the scenes, enabling me to use it more effectively in combination with Vaadin.