Comments (7)
I went for a different approach: https://balusc.omnifaces.org/2023/11/using-omnifaces-cdi-viewscoped-with.html
from joinfaces.
The first and most important step would be to implement the org.springframework.beans.factory.config.Scope
interface in order to give Spring access to the OmniFaces ViewScope. Our Implementation for the "normal" ViewScope can be found here: https://github.com/joinfaces/joinfaces/blob/4.7.x/joinfaces-autoconfigure/src/main/java/org/joinfaces/autoconfigure/viewscope/ViewScope.java
After this, a bit of plumbing is needed to get it to work:
The new Scope Implementation needs to be registered with the Spring ApplicationContext. We do this here: https://github.com/joinfaces/joinfaces/blob/4.7.x/joinfaces-autoconfigure/src/main/java/org/joinfaces/autoconfigure/viewscope/ViewScopeAutoConfiguration.java
With these two steps, the new Scope could be used with the @org.springframework.context.annotation.Scope("omnifaces-view")
annotation. (Or whatever name you have chosen for the scope)
In order to support @org.omnifaces.cdi.ViewScoped
as marker-annotation as well, you can define a CustomScopeAnnotationConfigurer
as we do here for the "normal" JSF Scope annotations: https://github.com/joinfaces/joinfaces/blob/4.7.x/joinfaces-autoconfigure/src/main/java/org/joinfaces/autoconfigure/scopemapping/JsfScopeAnnotationsAutoConfiguration.java
(This is a BeanFactoryPostProcessor which modifies the scope information in the BeanDefinitions if the bean class has a given annotation)
from joinfaces.
Thank you for the response. So in other words, the OmniFaces ViewScopeManager needs to be ported to Spring in its entirety, including the unload/destroy features?
from joinfaces.
@BalusC we tried your approach but the cdi-extension doesn't get our @Named
annotated class - so weld doesn't found them in the first place?
Can you please have a look at our example project based on the joinfaces example project? Would be a great feature for joinfaces to deliver full omnifaces capabilities :)
Here the forked example: https://github.com/JohannesProbst/joinfaces-gradle-war-example
from joinfaces.
@JohannesProbst it's not working inside IntelliJ.
Building a .war file and run it alone works as expected.
from joinfaces.
the following org.jboss.weld.environment.deployment.discovery.BeanArchiveHandler
service helped out:
@Priority(Integer.MAX_VALUE)
public class IntelliJFileSystemBeanArchivHandler extends FileSystemBeanArchiveHandler {
@Override
public BeanArchiveBuilder handle(String path) {
final Path target;
try {
target = Path.of(path);
} catch (Exception e) {
return null;
}
return super.handle(target.getParent().resolve(Path.of("classes")).toString());
}
}
from joinfaces.
@zeners Thx - you are right - it was the different places of binaries and resources while running it in intellij! Your ArchiveHandler helped.
from joinfaces.
Related Issues (20)
- I fixed Mojarra just for JoinFaces, please update Mojarra
- War deployment of Joinfaces 5.0.2 Startup Error. HOT 1
- Doesn't see the webapp when there are multiple modules. HOT 3
- Include instructions on how to switch from Mojarra 3 to 4 (Jakarta Faces) HOT 3
- Upgrade to spring boot v3 'OCPsoft Rewrite Filter' is not loading HOT 4
- Current Spring/Spring Boot Vulnerabilities: Please release JoinFaces 4.7.11 + 5.0.6! HOT 2
- Can't build gradle project with 5.0.6 HOT 2
- Angularfaces link is broken HOT 1
- Blank page as no faces EL is resolved in page. HOT 2
- Tomcat war deployment not working HOT 1
- Problem with Spring Boot Container HOT 3
- Provide a joinfaces bom without spring-boot-dependencies HOT 8
- Could not release joinfaces 5.2.0-rc1 HOT 1
- omnifaces not working in packaged jar in spring boot 3.2.0-RC1 HOT 1
- rewrite-spring-boot-starter not working with spring-aot
- Error with rewrite with joinfaces 3.2.0-rc2 HOT 3
- How to generate a preparedScanResult? HOT 2
- WAR file example not starting on Tomcat 10.1.16 with openjdk version "17.0.9" 2023-10-17 HOT 1
- Could not resolve plugin artifact 'org.joinfaces:org.joinfaces.gradle.plugin:5.2.1' HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from joinfaces.