如何使用 Vaadin FLOW server-push with Spring Boot

How to use Vaadin FLOW server-push with Spring Boot

当我在视图上使用@Push 注释时,出现以下异常(JDK 16,Vaadin 19.0.7,Spring boot 2.4.7):

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:162) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577) ~[spring-context-5.3.8.jar:5.3.8]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:771) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:763) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:438) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:339) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1329) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1318) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at net.cbsolution.chameleon.ChameleonApplication.main(ChameleonApplication.java:10) ~[classes/:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[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:567) ~[na:na]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:142) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:104) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:450) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:199) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:181) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:159) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    ... 14 common frames omitted
Caused by: java.lang.IllegalStateException: StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[] failed to start
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.rethrowDeferredStartupExceptions(TomcatWebServer.java:187) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:126) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    ... 19 common frames omitted

Spring开机使用服务器推送应该怎么做?谁能指出一个有效的例子?

这是完整的日志:

  .   ____          _            __ _ _
 /\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v2.4.7-SNAPSHOT)

2021-06-20 18:59:24.644  INFO 33309 --- [  restartedMain] n.c.chameleon.ChameleonApplication       : Starting ChameleonApplication using Java 16 on franco-HP-ZBook-15-G5 with PID 33309 (/home/franco/projects/chameleon/target/classes started by franco in /home/franco/projects/chameleon)
2021-06-20 18:59:24.646  INFO 33309 --- [  restartedMain] n.c.chameleon.ChameleonApplication       : No active profile set, falling back to default profiles: default
2021-06-20 18:59:24.672  INFO 33309 --- [  restartedMain] o.s.b.devtools.restart.ChangeableUrls    : The Class-Path manifest attribute in /home/franco/.m2/repository/com/vaadin/license-checker/1.2.0/license-checker-1.2.0.jar referenced one or more files that do not exist: file:/home/franco/.m2/repository/com/vaadin/license-checker/1.2.0/gwt-elemental-2.8.2.vaadin2.jar,file:/home/franco/.m2/repository/com/vaadin/license-checker/1.2.0/oshi-core-5.5.0.jar,file:/home/franco/.m2/repository/com/vaadin/license-checker/1.2.0/jna-5.7.0.jar,file:/home/franco/.m2/repository/com/vaadin/license-checker/1.2.0/jna-platform-5.7.0.jar,file:/home/franco/.m2/repository/com/vaadin/license-checker/1.2.0/slf4j-api-1.7.30.jar
2021-06-20 18:59:24.672  INFO 33309 --- [  restartedMain] o.s.b.devtools.restart.ChangeableUrls    : The Class-Path manifest attribute in /home/franco/.m2/repository/com/oracle/database/jdbc/ojdbc8/19.8.0.0/ojdbc8-19.8.0.0.jar referenced one or more files that do not exist: file:/home/franco/.m2/repository/com/oracle/database/jdbc/ojdbc8/19.8.0.0/oraclepki.jar
2021-06-20 18:59:24.672  INFO 33309 --- [  restartedMain] o.s.b.devtools.restart.ChangeableUrls    : The Class-Path manifest attribute in /home/franco/.m2/repository/com/cronutils/cron-utils/9.1.5/cron-utils-9.1.5.jar referenced one or more files that do not exist: file:/home/franco/.m2/repository/com/cronutils/cron-utils/9.1.5/slf4j-api-1.7.30.jar,file:/home/franco/.m2/repository/com/cronutils/cron-utils/9.1.5/javax.el-3.0.0.jar
2021-06-20 18:59:24.672  INFO 33309 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2021-06-20 18:59:24.672  INFO 33309 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2021-06-20 18:59:25.095  INFO 33309 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2021-06-20 18:59:25.130  INFO 33309 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 32 ms. Found 6 JPA repository interfaces.
2021-06-20 18:59:25.471  INFO 33309 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2021-06-20 18:59:25.475  INFO 33309 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2021-06-20 18:59:25.475  INFO 33309 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.46]
2021-06-20 18:59:25.525  INFO 33309 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2021-06-20 18:59:25.525  INFO 33309 --- [  restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 853 ms
2021-06-20 18:59:25.574  INFO 33309 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2021-06-20 18:59:25.734  INFO 33309 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2021-06-20 18:59:25.737  INFO 33309 --- [  restartedMain] o.s.b.a.h2.H2ConsoleAutoConfiguration    : H2 console available at '/h2-console'. Database available at 'jdbc:postgresql://localhost:5432/chameleon'
2021-06-20 18:59:25.841  INFO 33309 --- [  restartedMain] c.v.f.s.VaadinServletContextInitializer  : Search for VaadinAppShell took 17 ms
2021-06-20 18:59:25.843  INFO 33309 --- [  restartedMain] c.v.f.s.s.VaadinAppShellInitializer      : Using net.cbsolution.chameleon.MyAppShellConfigurator class for configuring `index.html` response
2021-06-20 18:59:25.848 ERROR 33309 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Exception sending context initialized event to listener instance of class [com.vaadin.flow.spring.VaadinServletContextInitializer$CompositeServletContextListener]

java.lang.RuntimeException: Unable to initialize com.vaadin.flow.spring.VaadinServletContextInitializer$VaadinAppShellContextListener
    at com.vaadin.flow.spring.VaadinServletContextInitializer$FailFastServletContextListener.contextInitialized(VaadinServletContextInitializer.java:192) ~[vaadin-spring-16.0.1.jar:na]
    at com.vaadin.flow.spring.VaadinServletContextInitializer$CompositeServletContextListener.lambda$contextInitialized[=12=](VaadinServletContextInitializer.java:209) ~[vaadin-spring-16.0.1.jar:na]
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) ~[na:na]
    at com.vaadin.flow.spring.VaadinServletContextInitializer$CompositeServletContextListener.contextInitialized(VaadinServletContextInitializer.java:209) ~[vaadin-spring-16.0.1.jar:na]
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4714) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5172) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
    at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) ~[na:na]
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:829) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
    at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) ~[na:na]
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:433) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
    at org.apache.catalina.startup.Tomcat.start(Tomcat.java:486) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:123) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:104) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:450) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:199) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:181) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:159) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577) ~[spring-context-5.3.8.jar:5.3.8]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:771) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:763) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:438) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:339) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1329) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1318) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at net.cbsolution.chameleon.ChameleonApplication.main(ChameleonApplication.java:10) ~[classes/:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[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:567) ~[na:na]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
Caused by: com.vaadin.flow.server.InvalidApplicationConfigurationException: 

Found app shell configuration annotations in non `AppShellConfigurator` classes.
Please create a custom class implementing `AppShellConfigurator` and move the following annotations to it:
    - @Push from net.cbsolution.chameleon.ui.views.AlertView

    at com.vaadin.flow.server.startup.VaadinAppShellInitializer.init(VaadinAppShellInitializer.java:157) ~[flow-server-6.0.8.jar:6.0.8]
    at com.vaadin.flow.server.startup.VaadinAppShellInitializer.init(VaadinAppShellInitializer.java:94) ~[flow-server-6.0.8.jar:6.0.8]
    at com.vaadin.flow.spring.VaadinServletContextInitializer$VaadinAppShellContextListener.failFastContextInitialized(VaadinServletContextInitializer.java:550) ~[vaadin-spring-16.0.1.jar:na]
    at com.vaadin.flow.spring.VaadinServletContextInitializer$FailFastServletContextListener.contextInitialized(VaadinServletContextInitializer.java:188) ~[vaadin-spring-16.0.1.jar:na]
    ... 47 common frames omitted

2021-06-20 18:59:25.848 ERROR 33309 --- [  restartedMain] o.apache.catalina.core.StandardContext   : One or more listeners failed to start. Full details will be found in the appropriate container log file
2021-06-20 18:59:25.849 ERROR 33309 --- [  restartedMain] o.apache.catalina.core.StandardContext   : Context [] startup failed due to previous errors
2021-06-20 18:59:25.852  WARN 33309 --- [  restartedMain] o.a.c.loader.WebappClassLoaderBase       : The web application [ROOT] appears to have started a thread named [HikariPool-1 housekeeper] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 java.base@16/jdk.internal.misc.Unsafe.park(Native Method)
 java.base@16/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:252)
 java.base@16/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:1661)
 java.base@16/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1182)
 java.base@16/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:899)
 java.base@16/java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1056)
 java.base@16/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1116)
 java.base@16/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
 java.base@16/java.lang.Thread.run(Thread.java:831)
2021-06-20 18:59:25.853  WARN 33309 --- [  restartedMain] o.a.c.loader.WebappClassLoaderBase       : The web application [ROOT] appears to have started a thread named [HikariPool-1 connection adder] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 java.base@16/java.lang.String.equals(String.java:1027)
 java.base@16/sun.security.ssl.CipherSuite.nameOf(CipherSuite.java:898)
 java.base@16/sun.security.ssl.SSLAlgorithmDecomposer.decompose(SSLAlgorithmDecomposer.java:262)
 java.base@16/sun.security.util.AbstractAlgorithmConstraints.checkAlgorithm(AbstractAlgorithmConstraints.java:99)
 java.base@16/sun.security.util.DisabledAlgorithmConstraints.permits(DisabledAlgorithmConstraints.java:140)
 java.base@16/sun.security.ssl.SSLAlgorithmConstraints.permits(SSLAlgorithmConstraints.java:164)
 java.base@16/sun.security.ssl.SSLAlgorithmConstraints.permits(SSLAlgorithmConstraints.java:154)
 java.base@16/sun.security.ssl.HandshakeContext.isActivatable(HandshakeContext.java:550)
 java.base@16/sun.security.ssl.HandshakeContext.getActiveCipherSuites(HandshakeContext.java:339)
 java.base@16/sun.security.ssl.HandshakeContext.<init>(HandshakeContext.java:185)
 java.base@16/sun.security.ssl.ClientHandshakeContext.<init>(ClientHandshakeContext.java:98)
 java.base@16/sun.security.ssl.TransportContext.kickstart(TransportContext.java:238)
 java.base@16/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:434)
 java.base@16/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:412)
 app//org.postgresql.ssl.MakeSSL.convert(MakeSSL.java:41)
 app//org.postgresql.core.v3.ConnectionFactoryImpl.enableSSL(ConnectionFactoryImpl.java:534)
 app//org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:149)
 app//org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:213)
 app//org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:51)
 app//org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:223)
 app//org.postgresql.Driver.makeConnection(Driver.java:465)
 app//org.postgresql.Driver.connect(Driver.java:264)
 app//com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
 app//com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:358)
 app//com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206)
 app//com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:477)
 app//com.zaxxer.hikari.pool.HikariPool.access0(HikariPool.java:71)
 app//com.zaxxer.hikari.pool.HikariPool$PoolEntryCreator.call(HikariPool.java:725)
 app//com.zaxxer.hikari.pool.HikariPool$PoolEntryCreator.call(HikariPool.java:711)
 java.base@16/java.util.concurrent.FutureTask.run(FutureTask.java:264)
 java.base@16/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
 java.base@16/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
 java.base@16/java.lang.Thread.run(Thread.java:831)
2021-06-20 18:59:25.870  INFO 33309 --- [  restartedMain] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2021-06-20 18:59:25.872  WARN 33309 --- [  restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
2021-06-20 18:59:25.873  INFO 33309 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
2021-06-20 18:59:25.878  INFO 33309 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.
2021-06-20 18:59:25.885  INFO 33309 --- [  restartedMain] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-06-20 18:59:25.895 ERROR 33309 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed

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:162) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577) ~[spring-context-5.3.8.jar:5.3.8]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:771) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:763) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:438) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:339) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1329) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1318) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at net.cbsolution.chameleon.ChameleonApplication.main(ChameleonApplication.java:10) ~[classes/:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[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:567) ~[na:na]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:142) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:104) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:450) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:199) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:181) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:159) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    ... 14 common frames omitted
Caused by: java.lang.IllegalStateException: StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[] failed to start
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.rethrowDeferredStartupExceptions(TomcatWebServer.java:187) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:126) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
    ... 19 common frames omitted


Process finished with exit code 0

这里是 MyAppShellConfigurator:

package net.cbsolution.chameleon;

import com.vaadin.flow.component.page.AppShellConfigurator;
import com.vaadin.flow.component.page.Push;

@Push
public class MyAppShellConfigurator implements AppShellConfigurator {
}

您必须为“整个”应用程序添加注释(@Push 是)到您的中央配置位置(这是 class 实施 AppShellConfigurator)。如错误所述:

Found app shell configuration annotations in non `AppShellConfigurator` classes.
Please create a custom class implementing `AppShellConfigurator` and move the following annotations to it:
  - @Push from net.cbsolution.chameleon.ui.views.AlertView

net.cbsolution.chameleon.ui.views.AlertView 中删除 @Push(如 如您的代码粘贴所示,它已经在您的 MyAppShellConfigurator 上设置了。