I am trying to use full java based configuration in my spring environment with primefaces 5.2. I also want to use the spark theme and layout. I nearly achieved all configurations but I'm stuck with two problems.
First (the most important one :)), I need to define the render kit aso in java config. This is the XML defintion.
<faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">
<name>primefaces-spark</name>
<component>
<component-type>org.primefaces.component.SparkMenu</component-type>
<component-class>org.primefaces.spark.component.menu.SparkMenu</component-class>
</component>
<render-kit>
<renderer>
<component-family>org.primefaces.component</component-family>
<renderer-type>org.primefaces.component.SparkMenuRenderer</renderer-type>
<renderer-class>org.primefaces.spark.component.menu.SparkMenuRenderer</renderer-class>
</renderer>
</render-kit>
</faces-config>
Has anyone an idea how I can set these values in pure java based config? I also tried to find a reference list of possible java based configuration properties but didn't find one :(. I also could live with an solution where I can mix my java based configuration with an XML based faces-config.xml as a workaround. But by only putting in an additional faces-config.xml with the information above into the WEB-INF does not work. It seems I need to do a little more than that :).
Second, I need to define Mime types which are defined in XML like this:
<mime-mapping>
<extension>ttf</extension>
<mime-type>application/font-sfnt</mime-type>
</mime-mapping>
This is not the most urgent thing as I can use a workaround by putting them into the web.xml (but I would prefer doing this in pure java config).
I also tried to use a class from spring boot (but I'm not programming a spring boot environment).
@Configuration
public class MimeMapper implements EmbeddedServletContainerCustomizer {
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
mappings.add("ttf", "application/font-sfnt");
mappings.add("svg#fontawesomeregular", "image/svg+xml");
container.setMimeMappings(mappings);
}
}
But this is not working, as it does not get loaded by the application (I tried it by referencing the configuration class in my AbstractAnnotationConfigDispatcherServletInitializer by adding it to the getRootConfigClasses() definition).
Thx for any suggestions,
BR,