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 convert unary fractional digits to binary fractional digits (is there a way?)
Choose audio when I convert MKV to MP4 VLC
Talend Convert string to Float
How to convert currency from dollar to euro and GBP live exchange rate
Convert html angularjs to its JavaScript equivalent
Convert 6 digit number into weekday (python)
Is there a way to convert gltf to dae?
How to use addFormatters in WebMvcConfigurerAdapter
Convert GIF into video - xCode 8 and swift 3
Download GIF option in UIActivityViewController - xcode8 swift3
Does Backand help me convert my angularjs to ionic?
How to configure a log4net custom PatternLayoutConverter in code
Converting .x3g to .s3g?
JSF optional converter in composite component
ISO 3166 code conversion - Alpha to numeric
Document to Text converter, return structure of the text

Categories

HOME
crystal-reports
meshlab
freepascal
bower
boost-thread
angular2-routing
memory-leaks
jscript
jrebel
xtext
data-science-experience
avl-tree
requirejs
eclipse-cdt
cosmicmind
ida
bar-chart
linq-to-sql
ios10.3
plupload
pycrypto
sonarqube-msbuild-runner
k2
tflearn
compare-and-swap
hanami
cep
web-frontend
system.data.sqlite
forum
pitest
roundcube
lmdb
twitter-bootstrap-2
exponential
expand
idl
polymorphism
pace
deepstream.io
intellilock
ideone
seamless-immutable
visual-studio-templates
pdfkit
typhoon
cfeclipse
windows-azure-pack
xib
instruments
jackson-databind
squirrel
scriptlet
twgl.js
portfolio
direct3d12
android-viewholder
unity5.3
lmfit
rad
js-cookie
paypal-nvp
visual-studio-code
connection-reset
playscape
debian-based
vcl
firebug-lite
method-overriding
wss
kraken.js
initialization-vector
svcutil.exe
flash-cc
visual-studio-addins
facebook-sdk-3.1
windows-update
qtgui
fileconveyor
vertical-scrolling
snapjs
autostart
vim-powerline
entity-framework-ctp5
nssavepanel
printing-web-page
scala-2.8
web-statistics
internals





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