webapp folder of ZK spring boot?

asked 2018-04-13 06:21:59 +0800

Sam888 gravatar image Sam888

updated 2018-04-13 06:23:23 +0800

Hi ZK,

The zk-spring-boot example at https: //github.com/zkoss-demo/zk-spring-boot doesn't have webapp folder, which is the de-facto folder for containing front end files, i.e. css, images, zul, ...

Is that really the intention of best practice or an oversight, or work in progress?

Am I right to assume /src/main/resources/web plays the role as webapp folder from now on for ZK spring boot?

If I am going to start a new ZK project using spring boot, is it a good ZK practice to use zk-spring-boot as a starter template?

How to configure web app domain name?

In old way, nothing under webapp/web-inf/ folder can be accessed directly hence secured automatically. What's the equivalent in the zk-spring-boot example?



delete flag offensive retag edit


There is nothing wrong with spring boot. The example is a jar, but you can still make a project the old way with spring boot, meaning a war and default folders. Like this you can deployment it on other servers to

chillworld ( 2018-04-13 12:15:59 +0800 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-04-22 17:10:51 +0800

cor3000 gravatar image cor3000
6280 2 7

Spring boot comes in different deployment modes.

War file or jar file (maybe more but those are the 2 basic ones). If you are creating a war-file you can keep putting your resources into the webapp folder which is as you say the de-facto standard web-applications following the servlet standard. Then you can deploy your war file in a tomcat/jetty/wildfly as before. Also the default way to configure your ZK application will work as before.

However when building a self contained, executable jar file (which contains an embedded jetty/tomcat), you are somewhat leaving the "de-facto" standard and enter the spring boot world. Inside the jar file (as far as I figured out - corrections are welcome) you cannot use an old fashioned webapp and WEB-INF folder and configuration is mostly done in Java. Additional ZK configuration can be loaded from multiple sources and WEB-INF/zk.xml is not the only location ZK looks for (metainfo/zk/zk.xml will do as well).

In a similar way ZK has a mechanism to load resources from the classpath below the web folder (e.g. used with ZK's themes and js files). So you can put resources you need for your ZK application there.

Spring boot has its own convention also shown in the example project - the static/ folder which (IMO) serves the purpose of the classic webapp folder.

I haven't found direct documentation on what the exact equivalent of WEB-INF is in a spring boot application.

Basically everything in your classpath (src/main/resources) will be hidden unless it is exposed otherwise by either spring convention "static/"-folder or ZK convention "web/"-folder.

Before using Spring boot you should have a clear understanding of what Spring boot is doing "under the hood". The example merely explains how ZK can be used on top of the default Spring boot web app auto-configuration.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2018-04-13 06:21:59 +0800

Seen: 36 times

Last updated: Apr 22 '18

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More