So the Push feature requires adding to the web.xml. Spring Boot doesn’t use a web.xml file so how can you use Push when you are using Spring Boot?
Hi Brian,
It requires vaadin-push as a dependency and then you can activate it adding @Push annotation to the UI. Should work out of the box. If it doesn’t, then we’ll need more details about the issues.
//Teemu
Thanks Teemu,
I took your suggestion and now I am getting the following:
Atmosphere could not be loaded. When using push with Vaadin, the
Atmosphere framework must be present on the classpath.
If using a dependency management system, please add a dependency
to vaadin-push.
If managing dependencies manually, please make sure Atmosphere
2.2.7.vaadin1 is included on the classpath.
Will fall back to using PushMode.DISABLED.
Looking at Maven Central there are a lot of different Atmosphere jars. Is there some information somewhere that will tell me which ones I need?
Hi Brian, please look in your deployment WEB-INF/lib/ folder and ensure you have these jars:
atmosphere-runtime-2.2.7.vaadin1.jar
vaadin-push-7.5.8.jar
Thanks cboyd.
I added the following and verified that those two jars are in the build but I am still getting the same error. Any other ideas?
com.vaadin.external.atmosphere atmosphere-runtime 2.2.7.vaadin1I can’t get this to work. Still getting:
Atmosphere could not be loaded. When using push with Vaadin, the
Atmosphere framework must be present on the classpath.
If using a dependency management system, please add a dependency
to vaadin-push.
If managing dependencies manually, please make sure Atmosphere
2.2.7.vaadin1 is included on the classpath.
Will fall back to using PushMode.DISABLED.
What other details do you need?
Which versions are you using?
What I just did to test it:
- get a Spring Boot project from Spring Initializr with the “get zip” link on
https://vaadin.com/docs/latest/flow/intergrations/spring/
- add a UI class in the project:
@SpringUI public static class VaadinUI extends UI {
protected void init(VaadinRequest request) {
setContent(new Label("Hello!"));
}
}
- add a dependency in pom.xml:
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-push</artifactId>
</dependency>
- run "mvn clean package spring-boot:run
- open: localhost:8080
Push is initialized correctly and there are no errors/warnings in the logs.
Hello Henri,
Don’t you have to use the @Push annotation on your class to enable push?
Hi,
It was used when we tested it. He must’ve forgotten to add it to the copy pasted UI. I verified it as well and seemed to be working.
//Teemu
Thank you for verifying this works with boot. It verified for me that something was wrong on my end. Somehow my local maven repo got corrupted. I wiped it out and started fresh and now push is working.
I also use spring-boot to make vaadin-spring projects. I have a problem with my session scoped beans and vaadin-push. Spring throws an exception telling me that I cannot use session beans from the separate thread. The problem had been discussed here
https://vaadin.com/forum#!/thread/3536891
too. So which is the proper way for me to fix that?