There are a lot of people talking about Java EE configuration these days. But often they forget about JNDI (Java Naming and Directory Interface).
Configuration using JNDI has the advantage that you can use dependency injection. i.e.
@Resource(mappedName = “java:global/mystring”)
private String mystring;
The configuration for example in JBosss EAP or Wildfly is pretty simple made in the standalone.xml (or domain.xml) file:
As you can see the type can be defined. If you need more complex objects simply use ObjectFactory http://docs.oracle.com/javase/7/docs/api/javax/naming/spi/ObjectFactory.html
Read more about JNDI in WildFly: https://docs.jboss.org/author/display/WFLY8/JNDI+Reference
and more about ObjectFactory: http://middlewaremagic.com/jboss/?p=1690