PrimeFaces is integrated with the ThemeRoller CSS Framework in order to support different themes. There are three types of themes you can configure:

  1. You can purchase premium themes
  2. You can choose from the free community themes
  3. You can create your own theme using the online theme generator tool of ThemeRoller.

The following example shows how to setup a PrimeFaces theme using Spring Boot and Maven.

General Project Setup

Tools used:

  • Spring Boot 1.5
  • PrimeFaces 6.1
  • JoinFaces 2.4
  • Maven 3.5

As the PrimeFaces community themes are not available in the Maven central repository we need to specify the PrimeFaces Maven Repository in our Maven POM file as shown below.

Once this is done we need to include the dependency to the specific PrimeFaces theme we want to use. Alternatively, we can include all available themes by specifying the all-themes dependency. We will do the later in this example.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="" xmlns:xsi=""


  <description>JSF - Primefaces Theme using Spring Boot</description>

    <relativePath /> <!-- lookup parent from repository -->


    <!-- spring-boot -->
    <!-- joinfaces -->
    <!-- primefaces -->

      <name>PrimeFaces Maven Repository</name>

      <!-- spring-boot-maven-plugin -->

We will start from a previous JSF Spring Boot Example in which we created a greeting dialog based on a first and last name input field.

As we are using JoinFaces to setup Spring Boot we can use an application property in order to configure a PrimeFaces theme.

We set the 'Afterdark' theme by specifying the 'jsf.primefaces.theme' property in src/main/resources/application.yml as shown below.

    theme: afterdark

  context-path: /codenotfound
  port: 9090

Let’s checkout the new look of our web application by running following Maven command:

mvn spring-boot:run

Once Spring Boot has started, open a web browser and enter the following URL: http://localhost:9090/codenotfound/helloworld.xhtml.

The below web page should now be displayed in the newly configured theme.

jsf primefaces theme spring boot

github mark If you would like to run the above code sample you can get the full source code here.

In this post, we illustrated how to configure a Spring Boot PrimeFaces theme.

Drop a line below if you enjoyed reading this post.

Leave a Comment