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

Document to Text converter, return structure of the text
read a .fit file on Linux
Calculating fixed point and two complement number with any bits range
Cisco to Alcatel Config Converter
Why conversion works on the idle but not executing the program?
Formula to convert IPv6 Address to IP number
Convert .nq (N-QUAD) file to .ttl (TURTLE)?
How to convert an MP3 file to an OGG OPUS file?
Is there a command to turn several po files into a multilingual list?
Advanced Bat to EXE Converter
Nibble Restriction to 0-9
How to convert imageSet to idx3-ubyte format, using mnisten,
Only One ADC but many Channels
how do i convert photographs to tensors
convert music to image and back
Method with #JmsListener not executed when setting custom message converter

Categories

HOME
meshlab
mapping
antivirus
bower
ubuntu-16.04
jasmine
smartphone
qpython3
chaiscript
histogrammar
pca
google-shopping
cortex-a
cpanel
store
symfony2-easyadmin
uicollectionview
bar-chart
derived
movies
eclipselink
attask
pycrypto
multiple-columns
header-files
yosys
mef2
i3
pcre
superagent
cell-array
ioc-container
pari
superpowered
threshold
jquery-cycle2
google-guava-cache
sidr
socketpair
axis-labels
declare
brute-force
floating-accuracy
socketscan
jupyter-console
intersystems-ensemble
filepath
floor
defold
dimple.js
chunked-encoding
web-deployment-project
broadcast
jenkins-jira-trigger
mouseclick-event
greenhills
teiid
lotus
software-product-lines
qregexp
contour
spring-lemon
console-redirect
test-class
drf-nested-routers
windows-vista
enyo
app.xaml
lmfit
kendo-menu
twython
prezto
pgm
shift-jis
ember-cli-addons
es2015
custom-url
gmaps4rails
gyroscope-framework
hidden-field
formvalidation-plugin
bullet
wss
magic-numbers
bounds
facebook-chat
bigint
onselect
html-form-post
ienumerator
qt4.6
css-tables
nsindexpath
cookieless
testunit
windows-live-id
phpcrawl
hadoop-plugins
visual-c++-2008-express
swfloader
scatterview
integer-promotion
divx

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App