Chapter 7. Configuring Seam components

Seam aims to minimize the need for XML-based configuration. However, there are various reasons you might want to configure Seam components with XML. To isolate deployment-specific information from the Java code, to enable the creation of reusable frameworks, to configure Seam's built-in functionality, and so on. Seam provides two basic approaches to component configuration; property settings in a properties file or web.xml file, and property settings components.xml file.

7.1. Configuring components through property settings

You can provide Seam with configuration properties with either servlet context parameters (in system properties), or with a properties file named seam.properties in the root of the classpath.
The configurable Seam component must expose JavaBean-style property setter methods for the configurable attributes. That is, if a Seam component named com.jboss.myapp.settings has a setter method named setLocale(), you can provide either:
  • a property named com.jboss.myapp.settings.locale in the seam.properties file
  • a system property named org.jboss.seam.properties.com.jboss.myapp.settings.locale through -D at startup
  • the same system property as a Servlet context parameter
Any of these can set the value of the locale attribute in the root of the class path.
The same mechanism is used to configure Seam itself. For example, to set conversation timeout, provide a value for org.jboss.seam.core.manager.conversationTimeout in web.xml, seam.properties, or through a system property prefixed with org.jboss.seam.properties. (There is a built-in Seam component named org.jboss.seam.core.manager with a setter method named setConversationTimeout().)