TomEE resource properties provider: one more step

I spoke recently ( ) of the ability to read using a custom API properties for TomEE resources but for enterprise context where you want to control all resources it was surely not enough for big applications.

To make it smoother to use you can now:

  • set it globally using org.apache.openejb.api.resource.PropertiesResourceProvider system property
  • get injected the serviceId without reading it from all properties

This means your properties provider implementation can look like:

public class MyProvider {
    private serviceId;

    public Properties provides() {
        return myLoader.load(serviceId);

myLoader being here just to abstract the fact you read in your enterprise configuration repository (MongoDB, a RDBMS, file system…).

To set it globally just add in conf/

org.apache.openejb.api.resource.PropertiesResourceProvider = org.superbiz.MyProvider

Side note: it doesn’t prevent your resource to specify custom properties. However keep in mind the provider will override it if there is a conflict.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s