JSF 2.2 and Spring 4 and CDI on different layers without losing Spring features

孤人 提交于 2019-12-08 20:10:40
bhdrk

I think to use Spring as CDI for JSF is best way (second option in your list) if you want all Spring features on JSF Managed Beans. to create custom ViewScope you can try this

http://blog.harezmi.com.tr/uncategorized/spring-view-scope-for-jsf-2-users/

this is better implementation to use ViewScope with Spring.

-- UPDATE --

I added a sample project on github. You can see it.

https://github.com/bhdrk/Tutorials/tree/master/spring4-jsf22-integration

One of my blog's readers reports that Spring beans are serializable in the latest version of Spring 3.2 (and hopefully Spring 4, but he didn't say anything about it). So you can use a standard JSF 2.2 @ViewScoped controller and have your Spring beans injected as managed properties. That's a tad unusual, because that's a third annotation (@ManagedProperty instead of @Autowire or @Inject). But I'm reported it works fine.

Read the full story (it's a bit too long to copy it here) at my blog.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!