zkoss / zkspringboot

ZK - Spring Boot integration
Apache License 2.0
53 stars 56 forks source link

Deploy to tomcat server auto configuration not work #3

Closed sesong11 closed 6 years ago

sesong11 commented 6 years ago

when I package war file and deploy to tomcat, home page return 404.

when I direct access to /minimal.zul it show all zul code. as bellow

<zk>
What's your name?: <textbox id="demoInput"/>
<button id="demoButton" label="Submit" onClick='demoLabel.setValue("Hello " + demoInput.getValue() + "!")'/>
<separator/>
<label id="demoLabel"/>

cor3000 commented 6 years ago

version 1.0.3 fixed this issue

now the ZatsSpringBootContextLoaderListener doesn't cause trouble when discovered by tomcat's class path scanning

cor3000 commented 6 years ago

this case was very specific to the differences in which ZATS/Springboot start up the servlet container ... I am extending the SpringBootServletInitializer class which is automatically detected on the classpath by the servlet container (e.g. tomcat) which is not aware of any spring config or even profiles at this stage:

All tomcat does is discover (even making it private didn't help) all classes implementing WebApplicationInitializer and provide the collection in onStartup https://github.com/spring-projects/spring-framework/blob/v5.0.8.RELEASE/spring-web/src/main/java/org/springframework/web/SpringServletContainerInitializer.java#L112

Spring will then just execute each of these WebApplicationInitializers ignoring further config, or none I could find.

If you can provide a cleaner way I'd be happy to consider merging a pull request.