Env-entries with OpenEJB ApplicationComposer?


A quick tip to customize env-entries when using the OpenEJB ApplicationComposer. Suppose you have a Bean “CustomBean” and you want to inject the env-entry “foo” with the value “bar”.

Since you can build the bean yourself with the ApplicationComposer, you can configure the env-entries yourself too very easily:

@Module
public EnterpriseBean bean() {
    final SingletonBean singletonBean = new SingletonBean(CustomBean.class);
    singletonBean.getEnvEntry().add(new EnvEntry("foo", String.class.getName(), "bar"));
    return singletonBean.localBean();
}
About these ads

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s