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 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
Convert text dataset to .arff file
How convert all files (uncompressed mkv DVD movies) to compressed mp4
How to convert BitmapImage to WriteableBitmap in Universal application for windows 10?
Celsius, Fahrenheit converter in java with JOptionPane
comparing a string in MIPS
Convert exe video to avi
filehelpers Custom converter
Converting numbers to hexadecimal
MIPS Roman numeral converter
Spring OAuth2 missing converter for DefaultOAuth2Token
Downgrade Conversion from Swagger 2.0 to 1.2

Categories

HOME
sql-server-2008
vb6
scipy
matplotlib
codeeffects
ll
phaser-framework
gspread
schemacrawler
ng-admin
aruco
lotus-notes
x11
mongodb-query
store
rapidjson
movies
device-detection
jconsole
multiplayer
ab-initio
vcard
solidworks
reply
multichoiceitems
vertex-buffer
blackboard
jackson-dataformat-csv
android-vpn-service
smart-mobile-studio
expand
modulo
honeysql
pox
boilerplate
wfp
autocompletetextview
xamarin.uitest
duktape
delphi-10.1-berlin
service-fabric-stateful
floor
chunked-encoding
tiddlywiki
shutdown
rollback
android-bitmap
butterknife
photography
hpcc
visual-studio-templates
system.web.ui.webcontrols
easing
zurb-foundation-apps
gradle-eclipse
elastix
distribute
group-concat
qt-linguist
bluesnap
difference
file-diffs
document-oriented-db
datasnap
uialertview
visual-studio-code
built-in
stream-framework
viper-architecture
bridge
gray-code
apache-mina
stackframe
jai
python-ggplot
kallithea
viewflipper
named-ranges
bsp
data-generation
delphi-xe3
internal
operations
visual-c++-2010-express
opendata
document-database
qss
vertical-scrolling
arbor.js
zend-framework-modules
static-variables
icefaces-3
entity-framework-ctp5
handwriting
paintcomponent
windows-live-id
adobe-contribute
hibernate3-maven-plugin
mvvm-foundation
filetime
hmacsha1
database-diagramming

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