This project is a demonstration of the integration of modern Jakarta EE and Spring technologies, including:
- Java 17
- Spring Boot 3
- Jakarta Faces (JSF) 4
- CDI 4
- Servlet 6
- Tomcat 10.1 (embedded)
- Packaged as a fat JAR
- Runs JSF 4 pages inside a Spring Boot 3 application.
- Spring-managed beans only (no CDI Beans).
- Includes usage of different Spring bean scopes (singleton, request, session, prototype).
- Custom JSF validator integration with Spring beans.
- Simple navigation between pages and form validation.
- Designed to run on an embedded Tomcat 10.1 server.
- Add a custom view scope in a spring context.
Build the project using Maven:
mvn clean packageThis will generate a jsf-fatjar-demo.jar file in the target/ directory.
You can run the application in one of two ways:
mvn spring-boot:runjava -jar target/jsf-fatjar-demo.jarOnce the application is running, open your browser and navigate to:
http://localhost:8080/demo/hello.xhtml
src
├── main
│ ├── java
│ │ └── com.example.demo
│ │ ├── beans # Spring beans
│ │ ├── config # JSF/CDI configuration
│ │ └── validators # Custom JSF validators
│ └── resources
│ ├── application.yml # yml file
│ └── META-INF
│ └── resources
│ ├── digit.xhtml # First JSF page
│ ├── hello.xhtml # Second JSF page
│ ├── resources
│ │ └── css # CSS
│ └── WEB-INF
│ └── faces-config.xml # Faces config file
There is an alternative branch named only-spring-beans that does not include any CDI beans,
making the configuration slightly simpler.
This project is released into the public domain. You are free to use, modify, and distribute it without restriction.
Java 17 • Spring Boot 3 • JSF 4 • Jakarta Faces 4 • CDI 4 • Servlet 6 • Tomcat 10.1 (embedded) • fat JAR
Jakarta Faces with Spring Boot on qwertovsky's blog.
And of course, BalusC's blog.