Installation

Togglz has been developed in a very modular manner. This allows you to select exactly the components of the framework you want to use. The installation process in the documentation will be explained using Apache Maven. But of course you can also use any other build system you want.

First you have to add the Togglz dependencies to your project. The only required dependency is the togglz-core module. If you want to integrate Togglz into a web application, you should also add the togglz-servlet module.

If your application uses CDI or Spring, you will typically also want to add the corresponding integration modules.

<!-- Togglz core module (mandatory) -->
<dependency>
  <groupId>org.togglz</groupId>
  <artifactId>togglz-core</artifactId>
  <version>3.1.2</version>
</dependency>

<!-- Togglz for Servlet environments (mandatory for webapps) -->
<dependency>
  <groupId>org.togglz</groupId>
  <artifactId>togglz-servlet</artifactId>
  <version>3.1.2</version>
</dependency>

<!-- CDI integration (optional) -->
<dependency>
  <groupId>org.togglz</groupId>
  <artifactId>togglz-cdi</artifactId>
  <version>3.1.2</version>
</dependency>

<!-- Spring integration (optional) -->
<dependency>
  <groupId>org.togglz</groupId>
  <artifactId>togglz-spring-web</artifactId>
  <version>3.1.2</version>
</dependency>

<!-- JSF integration (optional) -->
<dependency>
  <groupId>org.togglz</groupId>
  <artifactId>togglz-jsf</artifactId>
  <version>3.1.2</version>
</dependency> 

If your app is a web application and your container supports Servlet 3.0, you won't have to do any further configuration. But if your container doesn't support the Servlet 3.0 specification, you will have to add the following filter declaration to your /WEB-INF/web.xml:

<!-- Togglz configuration for Servlet 2.5 and earlier -->
<filter>
  <filter-name>TogglzFilter</filter-name>
  <filter-class>org.togglz.servlet.TogglzFilter</filter-class>
</filter>
<filter-mapping>
  <filter-name>TogglzFilter</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>

The installation of Togglz is now finished. The next step is to configure Togglz as described in the Configuration chapter.

Spring Boot Starter since 2.3.0

If you are using Spring Boot there is an alternative installation approach by using the togglz-spring-boot-starter module. This starter will install the common Togglz dependencies and will also perform auto configuration. See the Spring Boot Starter chapter for more info.