Using Push anotation on spring boot

Im using vaadin’s integration with Spring Boot and I have a class where i’d like to use @Push. Code (simplified)is the following:

@Route("")
@PermitAll
@Push
public class MainView extends VerticalLayout {

    private ExecutorService executorService = Executors.newCachedThreadPool();
    private Span a = new Span();

    public MainView() {

        add(new H1("Jardín Ale"));

        Paragraph paragraph = new Paragraph("Thing ");
 
        paragraph.add(a);

        add(paragraph);
    }


    @Override
    protected void onAttach(AttachEvent attachEvent) {
        super.onAttach(attachEvent);
        executorService.submit(() -> {
            while (true) {
                attachEvent.getUI().access(()->{
                  a.setText("Test");
              });
            }

        });
    }
    @Override
    protected void onDetach(DetachEvent detachEvent) {
        super.onDetach(detachEvent);
    }
}

Next message will have the error

If i don’t add the @Push it ofc doesn’t work, but when i add it i get the following error:

org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
    at  org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:165) ~[spring-boot-2.7.5.jar:2.7.5]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577) ~[spring-context-5.3.23.jar:5.3.23]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.5.jar:2.7.5]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734) ~[spring-boot-2.7.5.jar:2.7.5]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.5.jar:2.7.5]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-2.7.5.jar:2.7.5]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[spring-boot-2.7.5.jar:2.7.5]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[spring-boot-2.7.5.jar:2.7.5]
    at com.example.application.Application.main(Application.java:19) ~[main/:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.7.5.jar:2.7.5]

There is more stacktrace, here is an image of it
unknown.png

Push is not allowed to be placed on view classes

It has to be placed on a class implementing AppShellConfigurator

On this example it is being used on a view class right?https://vaadin.com/learn/training/v14-push

And it also does it in this tutorial:
https://vaadin.com/learn/training/v14-push

It has changed between Vaadin 23 ( from 15 if I remember correctly) and 14 : Server Push | Advanced Topics | Vaadin Docs and Server Push Configuration | Advanced Topics | Flow | Vaadin 14 Docs

TYVM guys

Vaadin should update the tutorial or at least say that’s outdated

@vital-koala, can you add a note on the training video page?