Wanted to set an initial value in a simple extension of the weld-se HelloWorld example in the beans.xml. But it is obviously ignored. I used weld 1.1.4.
Here my extension of HelloWorld class:
First the new property ...
private String filename;
public void setFilename(String name) {
filename = name;
}
public String getFilename() {
return filename;
}
... then output in method printHello():
if (!argsValidator.hasErrors()) {
System.out.println("Hello " + argsValidator.getValidParameters().get(0));
System.out.println(String.format("Filename: %1$s.", filename));
... and my beans.xml:
<beans xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:s="urn:java:ee"
xmlns:h="urn:java:org.jboss.weld.environment.se.example.simple">
<h:HelloWorld filename="abc"/>
</beans>
The output for the file name is null.
A similar extension in a JSF application is also ignored. Extending seam-beans.xml is also ignored.
But the @Inject is working as expected.
What's wrong with my extensions: Java or XML?