{"id":21399536,"url":"https://github.com/zkoss/zkspringboot","last_synced_at":"2025-04-05T17:07:47.316Z","repository":{"id":37789437,"uuid":"145380897","full_name":"zkoss/zkspringboot","owner":"zkoss","description":"ZK - Spring Boot integration ","archived":false,"fork":false,"pushed_at":"2025-02-05T04:38:16.000Z","size":471,"stargazers_count":61,"open_issues_count":1,"forks_count":57,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-29T16:08:42.974Z","etag":null,"topics":["springboot","starter","zk"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zkoss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-20T07:17:00.000Z","updated_at":"2025-02-11T03:11:10.000Z","dependencies_parsed_at":"2023-11-08T11:30:47.955Z","dependency_job_id":"1fcebc6f-b667-4452-9478-f2538a30091e","html_url":"https://github.com/zkoss/zkspringboot","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zkoss%2Fzkspringboot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zkoss%2Fzkspringboot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zkoss%2Fzkspringboot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zkoss%2Fzkspringboot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zkoss","download_url":"https://codeload.github.com/zkoss/zkspringboot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247369952,"owners_count":20927928,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["springboot","starter","zk"],"created_at":"2024-11-22T15:15:07.082Z","updated_at":"2025-04-05T17:07:47.299Z","avatar_url":"https://github.com/zkoss.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ZK - Spring Boot Starter\r\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\r\n\r\n* [zkspringboot-starter](zkspringboot-starter) : the starter project that helps you use spring-boot with zk easily.\r\n* [zkspringboot-autoconfig](zkspringboot-autoconfig) : apply default configuration in spring-boot for ZK.\r\n* [zkspringboot-demos](zkspringboot-demos) : contains demo projects.\r\n\r\n\r\n[Spring Boot 3.0](https://spring.io/blog/2022/05/24/preparing-for-spring-boot-3-0) makes use of Jakarta EE 9 APIs (`jakarta.*`) instead of EE 8 (`javax.*`).\r\n\r\n*(Adapted from Dirk's amazing [zk-spring-boot-starter](https://github.com/dirkdeyne/zk-spring-boot-starter) - Thanks a lot for the input and ideas!)*\r\n## Features\r\n* automatically apply default configurations in spring-boot for ZK \r\n* zul view resolver\r\n* zk-specific properties for configuration\r\n\r\n## Getting started\r\n\r\n* Add a single dependency (as in [zkspringboot-minimal-jar/pom.xml](zkspringboot-demos/zkspringboot-minimal-jar/pom.xml##L28-L32))\r\n* Place your zul files below [src/main/resources/web](zkspringboot-demos/zkspringboot-minimal-jar/src/main/resources/web/zul)\r\n* Create a spring controller or define a `zk.homepage` parameter in [application.properties](zkspringboot-demos/zkspringboot-minimal-jar/src/main/resources/application.properties)\r\n* or just have a look into the [demos](zkspringboot-demos)\r\n* when using `jar` packaging, including a file is different, please see [Application_structure](https://www.zkoss.org/wiki/ZK_Installation_Guide/Quick_Start/Create_and_Run_Your_First_ZK_Application_with_Spring_Boot#Application_structure)\r\n\r\n## Configuration options (for Spring Boot style application.properties)\r\n\r\nDefaults as in [ZkProperties.java](zkspringboot-autoconfig/src/main/java/org/zkoss/zkspringboot/ZkProperties.java)\r\n```\r\nzk.springboot-packaging=jar\r\n\r\nzk.homepage=\r\nzk.zul-view-resolver-enabled=true\r\nzk.zul-view-resolver-prefix=\r\nzk.zul-view-resolver-suffix=.zul\r\n\r\nzk.richlet-filter-mapping=\r\n\r\nzk.websockets-enabled=true\r\nzk.servlet3-push-enabled=true\r\nzk.update-uri=/zkau\r\n```\r\n\r\nproperty                                        | default | example(s)      | description\r\n----------------------------------------------- |---------|-----------------| -----------\r\n`zk.springboot-packaging`                       | `jar`   | `war`/`jar`     | package as jar or war file\r\n`zk.homepage`                                   | null    | `home`/`main`   | when set will setup a @GetMapping for \"/\" to return the configured view-name\r\n`zk.zul-view-resolver-enabled`                  | `true`  | `true`/`false`  | enable/disable InternalViewResolver for zul files\r\n`zk.zul-view-resolver-prefix`                   | empty   | `/zul`          | prefix prepended to a view name (i.e. a folder inside the web resource package on the classpath)\r\n`zk.zul-view-resolver-suffix`                   | `.zul`  | `.zul`/`.zhtml` | usually `.zul` does what you need\r\n`zk.richlet-filter-mapping`                     | null    | `/richlets/*`   | filter-mapping string as the basepath for richlets\r\n`zk.websockets-enabled=true`                    | `true`  | `true`/`false`  | enable/disable websockets (available in ZK-EE)\r\n`zk.servlet3-push-enabled=true`                 | `true`  | `true`/`false`  | enable/disable servlet3 CometServerPush (available in ZK-EE)\r\n`zk.update-uri`                                 | `/zkau` | `/mypath`       | configure servlet path for ZK's Update Engine (rarely used)\r\n`zk.resource-uri`                               | null    | `/zkres`        | configure/enable separate servlet path for ZK's Resource Engine (since ZK 9.5.0)\r\n`zk.stateless-dispatcher-richlet-filter-mapping`| null    | `/*`            | url-pattern for `org.zkoss.stateless.ui.http.DispatcherRichletFilter`. since 3.2.3\r\n`zk.stateless-dispatcher-richlet-filter-base`   | null    | `myrichlet`     | base package of your `StatelessRichlet`. since 3.2.3\r\n`zk.client-mvvm-listener-enabled`               | `false` | `true`          | if `true`, add a listener `org.zkoss.clientbind.BinderPropertiesRenderer` for client mvvm. since 3.2.3\r\n`zk.client-mvvm-globally-enabled`               | `false` | `true`          | if `true`, set the library property `org.zkoss.bind.defaultComposer.class` with `org.zkoss.clientbind.ClientBindComposer`. This enables client MVVM on the whole application. since 3.2.3\r\n\r\n### zk.homepage\r\nShortcut configuration to enable a Spring MVC Controller with a @GetMapping for the root path '/' returning the configured view name. (disabled by default).\r\nThe default zul-view-resolver config will prepend the the servlet mapping for ZK's update engine (default `/zkau`) and append the `.zul`-extension to locate the zul file in your application.\r\n\r\n### zk.zul-view-resolver-*\r\nDefines a simple InternalViewResolver resolving view names to zul files inside the class-web package (not required but still possible for `war` packaging).\r\n\r\nThe default root path that the zul view resolver looks for is:\r\n* war packaging\r\n`src/main/webapp`\r\n* jar packaging\r\n`src/main/resources/web/`\r\n\r\nFor example, given the get mapping:\r\n```java\r\n\t@GetMapping(\"/demo\")\r\n\tpublic String demo() {\r\n\t\treturn \"views/demo\";\r\n\t}\r\n```\r\nResolves to `/zkau/web/views/demo.zul`\r\n\r\nZK's DHtmlUpdateServlet will locate the file on the classpath e.g. in `src/main/resources/web/views/demo.zul`\r\nA configured prefix e.g. `/myprefix` will be inserted before the view name: `/zkau/web[/myprefix]/views/demo.zul`\r\n\r\n### zk.richlet-filter-mapping\r\nEnables [ZK's RichletFilter](https://www.zkoss.org/wiki/ZK_Developer's_Reference/UI_Composing/Richlet#Turn_on_Richlet). The value has to be a servlet filter mapping such as: `/richlet/*`\r\nRequires additional [richlet-mappings configured in zk.xml](https://www.zkoss.org/wiki/ZK_Configuration_Reference/zk.xml/The_richlet-mapping_Element).\r\n\r\n### zk.resource-uri \r\nRegisters and enables [ZK's Resource Engine](https://www.zkoss.org/wiki/ZK_Configuration_Reference/web.xml/ZK_Resource_Engine).\r\nWhen packging as war file this will also set the necessary [init-parameter for the ZK Loader Servlet](https://www.zkoss.org/wiki/ZK_Configuration_Reference/web.xml/ZK_Loader#The_Initial_Parameters)\r\n\r\n## Using springboot-devtools (restart)\r\n\r\nWhen using the restart feature of [spring-boot-devtools](https://docs.spring.io/spring-boot/docs/2.4.4/reference/html/using-spring-boot.html#using-boot-devtools) make sure to include the ZK jars in the restart process\r\nby [customizing the Restart Classloader](https://docs.spring.io/spring-boot/docs/2.4.4/reference/html/using-spring-boot.html#using-boot-devtools-customizing-classload).\r\n\r\nCreate a file on the classpath:\r\n\r\nsrc/main/resources/**META-INF/spring-devtools.properties**\r\n\r\n    restart.include.zklibs=/z[\\\\w]+-[\\\\w\\\\d-\\.]+\\.jar\r\n\r\nThis regex will match all jar files matching the expression e.g. `zk-9.5.1.jar` or `zul-9.5.1.jar` etc.\r\n\r\n### Reload zul change\r\nadd `spring.profiles.active=dev` in `application.properties`. After modifying a zul, re-build it, then your browser can load the latest zul.\r\nSee [Triggering a restart](https://docs.spring.io/spring-boot/docs/2.4.4/reference/html/using-spring-boot.html#using-boot-devtools-restart)\r\n\r\n\r\n## Debug Spring Boot Application\r\nBecause a breakpoint doesn't stop when running with Maven `springboot:run`, you can run an application with `@SpringBootApplication` class as a Java application in debug mode. \r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzkoss%2Fzkspringboot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzkoss%2Fzkspringboot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzkoss%2Fzkspringboot/lists"}