Environment specific configuration

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Environment specific configuration

Me Self
Hi All

How do I override configuration of JavaEE specific resources per
environment? Resources I need to override:
<env-entry> in web.xml
<resource-ref> datasources and email resources in web.xml or <Resource> in
resources.xml

So far this is what I think could work:
- Inspired by Tomcat i guess an external config in
/conf/Catalina/localhost/<context>.xml where <Environment> would override
<end-entry> and <Resource> would override <resource-ref> could work?
- Probably TomEE specific solution of overriding /WEB-INF/resources.xml
properties with system properties -DmyResource...=...?

The latter I found in a example to configure JavaMail on openejb.apache.com.
Would this also work for datasources? And is there a similar way to
override the value of <env-entry> with system properties?

What is the correct way to do this?
Reply | Threaded
Open this post in threaded view
|

Re: Environment specific configuration

Romain Manni-Bucau
Hi

Looks like you got it :). Only thing i can add is datasources don't need a
resources.xml and are better configured outside the webapp, it also makes
the overriding simpler since you don't need to prefix them with the webapp
name too.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2017-06-06 16:30 GMT+02:00 Me Self <[hidden email]>:

> Hi All
>
> How do I override configuration of JavaEE specific resources per
> environment? Resources I need to override:
> <env-entry> in web.xml
> <resource-ref> datasources and email resources in web.xml or <Resource> in
> resources.xml
>
> So far this is what I think could work:
> - Inspired by Tomcat i guess an external config in
> /conf/Catalina/localhost/<context>.xml where <Environment> would override
> <end-entry> and <Resource> would override <resource-ref> could work?
> - Probably TomEE specific solution of overriding /WEB-INF/resources.xml
> properties with system properties -DmyResource...=...?
>
> The latter I found in a example to configure JavaMail on
> openejb.apache.com.
> Would this also work for datasources? And is there a similar way to
> override the value of <env-entry> with system properties?
>
> What is the correct way to do this?
>