I've found some tutorials about integrating JSF technology with Spring Boot, but it seems a rather involved work to get OmniFaces working with Spring Boot. Is it a good idea to integrate these two together at all?
How to integrate OmniFaces with Spring Boot
Asked Answered
I've got the latest omnifaces 1.x version working with JSF 2.2 in a Spring Boot project. I believe the real integration relates to make JSF work in Spring Boot (which is couple of steps), not omnifaces. The reason why I keep with the 1.x branch is that it fulfills my requirements and doesn't require CDI. –
Apostles
@XtremeBiker: I didn't know that omnifaces 1.x version does not require CDI. Thanks. –
Amrita
OmniFaces is provided via JoinFaces.
<dependency>
<groupId>org.joinfaces</groupId>
<artifactId>omnifaces-spring-boot-starter</artifactId>
<version>5.x.x</version>
</dependency>
Or when you're still on Spring Boot 2.x:
<dependency>
<groupId>org.joinfaces</groupId>
<artifactId>omnifaces3-spring-boot-starter</artifactId>
<version>4.x.x</version>
</dependency>
In case you're primarily intertested in OmniFaces @ViewScoped
, then you really need @Named
instead of @Component
in order to fully utilize its powers. And in order to be able to inject existing Spring managed beans via @Autowired
into those @Named
beans without any additional fuzz, you might want to install a CDI extension as described in this blog Using OmniFaces CDI @ViewScoped with unload/destroy in a Spring Boot project.
See also:
© 2022 - 2024 — McMap. All rights reserved.