Difference between and

<context:annotation-config> is used to activate annotations in beans already registered in the application context (no matter if they were defined with XML or by package scanning). <context:component-scan> can also do what <context:annotation-config> does but <context:component-scan> also scans packages to find and register beans within the application context. I’ll use some examples to show the differences/similarities. … Read more

How to properly install and configure JSF libraries via Maven?

When you’re facing a “weird” exception suggesting that classes/methods/files/components/tags are absent or different while they are seemingly explicitly included in the web application such as the ones below, java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/faces/webapp/FacesServlet java.util.MissingResourceException: Can’t find javax.faces.LogStrings bundle com.sun.faces.vendor.WebContainerInjectionProvider cannot be cast to com.sun.faces.spi.InjectionProvider … Read more

Where to place and how to read configuration resource files in servlet based application?

It’s your choice. There are basically three ways in a Java web application archive (WAR): 1. Put it in classpath So that you can load it by ClassLoader#getResourceAsStream() with a classpath-relative path: ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); InputStream input = classLoader.getResourceAsStream(“foo.properties”); // … Properties properties = new Properties(); properties.load(input); Here foo.properties is supposed to be placed … Read more