converter


ApplicationScoped bean not injected in JSF 2.3 FacesConverter


I have following FacesConverter:
#FacesConverter(forClass = Onderwerp.class, managed = true)
public class OnderwerpConverter implements Converter<Onderwerp> {
#Inject
private Web web;
#Override
public Onderwerp getAsObject(FacesContext context, UIComponent component, String value) {
log.trace("Converting to object from string: " + value);
return web.getAllActiveOnderwerpen().stream().filter(o -> o.getId().equals(Long.parseLong(value))).findFirst().get();
}
#Override
public String getAsString(FacesContext context, UIComponent component, Onderwerp onderwerp) {
log.trace("Converting to string from object: " + onderwerp);
return onderwerp.getId().toString();
}
}
The referenced CDI bean is:
#Named
#ApplicationScoped
public class Web { ... }
Faces-config.xml is:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_3.xsd" version="2.3">
Now whatever kind of bean I inject via #Inject it is always null. It seems the injection feature in 2.3 is not working (yet), or I am missing something :)
I'm using Mojarra 2.3.0.
My current workaround is replacing the code where I need the injected CDI bean like this:
return CDI.current().select(Web.class).get().getAllActiveOnderwerpen().stream().filter(o -> o.getId().equals(Long.parseLong(value))).findFirst().get();
This works fine, but is kinda ugly of course :)
Anyone has experienced this behavior?


Related Links

how to embed currency converter on my website
Converting a text file to ascii in PYTHON code then ascii character
Conversion of standard InChI to InChI with fixed-hydrogen-layer
what coordinate system is this and how to convert it to longitude latitudes?
Converter doesn't work and not taken by criteria
Working with CGM version 4 files?
Convert docx to mediawiki and preserve [[Image:]]
Can gnuplot convert my temperature data on the fly?
Convert from VMWare to Hyper-V
Convert AMR file to WAV on C#
Submitting an SGE job to PBS/Torque
How to convert .rtp file(recorded using RTP Proxy codec G711) to .wav file
Converting pt and px
javascript change chars in a string
How can I use a CustomConverter with Dozer to convert multiple entities into one entity with a list field?
Convert T-SQL Declare statement to SAP HANA

Categories

HOME
caching
numpy
jenkins-plugins
openssl
hana
matplotlib
user
apiconnect
vuex
rfid
automata
x-frame-options
quartus
google-people
raphael
k2
qsub
tfs2013
croppic
net-snmp
bus-error
data-conversion
gzip
websauna
twitter-bootstrap-2
geo
division
initializer
topic-modeling
deepstream.io
flex4.5
android-maps-v2
excel-interop
catia
fastq
jgraph
applepayjs
jexl
gce
in-memory-database
autoresize
onresume
cleditor
activeweb
pydio
mailcatcher
software-product-lines
scalar
spark-cassandra-connector
gradle-eclipse
cctray
wikitext
code-readability
lmfit
kendo-menu
subresource-integrity
ipojo
integral
team-build
xjc
debian-based
shift-jis
scrollspy
multipleselection
proximity
mov
java-collections-api
author
codeigniter-a3m
uipickerviewcontroller
visual-c++-2010-express
shortcuts
android-4.0
qsqltablemodel
nintendo
fileutils
shared-objects
scraperwiki
executable-format
goliath
opengl-es-lighting
rubycas
carbide
trampolines
linfu
asp.net-mvc-controller
kpi
virtualquery
weborb
document-library





Mobile Apps Dev
Database Users
javascript
java
csharp
php
android


MS Developer
developer works
python
ios
c
html
jquery


RDBMS discuss