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

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
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

Categories

HOME
xbox-live
dotnetrdf
plsql
answer-set-programming
vb6
wsdl
bing
backup
angular2-routing
ubuntu-16.04
agile
cocos2d-x-3.0
amazon-product-api
azureservicebus
apple-numbers
checksum
java-home
onenote-api
hosts
getorgchart
jboss-eap-7
cockroachdb
nixos
squarespace
riak
cross-platform
yeoman-generator
off-canvas-menu
boolean-expression
ios10.3
ip-camera
cython
deb
epicor
richfaces
spring-ws
header-files
jquery-scrollify
philips-hue
jflex
tampermonkey
croppic
bus-error
weinre
superscript
entity-system
ifstream
css-counter
sidr
color-scheme
broadleaf-commerce
rhel.net
strstr
jquery-multidatespicker
tic-tac-toe
scalafx
rich-text-editor
azure-availability-set
data-integration
proof
spring-data-hadoop
dwarf
pagefile
gameanalytics
cmocka
self-hosting
zuora
selendroid
xjc
isml
subversion-edge
ember-cli-addons
hiera
gyroscope-framework
em
formvalidation-plugin
genetic-programming
funq
power-law
colt
picat
kraken.js
dbsetup
zipalign
reserved-words
visual-c++-2010-express
baucis
osx-snow-leopard
nsmatrix
nimrod
iconv
objcmongodb
dynamic-data
socketstream
parameterization
webkit-transform
rubycas
hibernate3-maven-plugin
grooveshark
swfloader
nt4
data-entry

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