Setting Up ZK Spring using Maven"
(rewrite for supported Spring version) |
(→Create a New Project with ZK Archetype: link to installation guide) |
||
Line 5: | Line 5: | ||
The simplest way to create a ZK maven project is using archetype: '''zk-ee-eval-archetype-webapp-spring'''. A project generated by this archetype will include required ZK and spring dependencies and ZK maven evaluation repository. | The simplest way to create a ZK maven project is using archetype: '''zk-ee-eval-archetype-webapp-spring'''. A project generated by this archetype will include required ZK and spring dependencies and ZK maven evaluation repository. | ||
− | If you use maven in a console, you need to specify ZK archetype catalog URL | + | If you use maven in a command line console, you need to specify ZK archetype catalog URL to generate your project. Please refer to [[ZK Installation Guide/Quick Start/Create and Run Your First ZK Application with Eclipse and Maven#Use the command line version of Maven to create a project]]. |
− | |||
− | |||
− | |||
− | |||
− | |||
+ | If you use eclipse, you can add the catalog URL via Window / Preferences / Maven / Archetypes, please refer to [[ZK Installation Guide/Quick Start/Create and Run Your First ZK Application with Eclipse and Maven#Add ZK Maven Archetype]] | ||
= Adding ZK Spring Dependencies = | = Adding ZK Spring Dependencies = |
Revision as of 04:10, 15 October 2014
Create a New Project with ZK Archetype
The simplest way to create a ZK maven project is using archetype: zk-ee-eval-archetype-webapp-spring. A project generated by this archetype will include required ZK and spring dependencies and ZK maven evaluation repository.
If you use maven in a command line console, you need to specify ZK archetype catalog URL to generate your project. Please refer to ZK Installation Guide/Quick Start/Create and Run Your First ZK Application with Eclipse and Maven#Use the command line version of Maven to create a project.
If you use eclipse, you can add the catalog URL via Window / Preferences / Maven / Archetypes, please refer to ZK Installation Guide/Quick Start/Create and Run Your First ZK Application with Eclipse and Maven#Add ZK Maven Archetype
Adding ZK Spring Dependencies
After creating a project, you still need to add ZK Spring dependencies. ZK Spring has 3 artifacts, you can add them upon your requirement.
For ZK 5, you can use 3.0 or above.
For ZK 6 or above, you should use 3.1 or above.
ZK Spring Core
<dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zkspring-core</artifactId>
<version>3.1.1</version>
</dependency>
ZK Spring Webflow
<dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zkspring-webflow</artifactId>
<version>3.1.1</version>
</dependency>
ZK Spring Security
<dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zkspring-security</artifactId>
<version>3.1.1</version>
</dependency>
Configuration in web.xml
You need to declare Spring ContextLoaderListener in the web.xml file to be able to declare and register your Spring beans with Spring framework.
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
Version History
Version | Date | Content |
---|---|---|
3.1.1 | 2014/10/07 | rewrite for supported Spring version |