You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Lilianne E. Blaze" <li...@tlen.pl> on 2008/06/03 03:38:55 UTC

Re: Configuring one webapp in 2 instances, system properties

You'll need something like that:

In Tomcat's:

<Environment name="shDatabase" 
value="jdbc:mysql://127.0.0.1:3306/shproduction" type="java.lang.String" 
override="false"/>  

In Spring config:

<jee:jndi-lookup id="shDatabaseStr" jndi-name="shDatabase"/>

<bean ...>
  <property name="url" ref="shDatabaseStr"/>
</bean>

Greetings, Lilianne E. Blaze


Bas Schulte wrote:
> Hi,
>
> I'd like to deploy my Spring-based webapp twice in the same Tomcat 
> instance, one for production and one for development.
>
> To configure my webapp, these distinct environments connect to 
> different database schema using different username/password combo's.
>
> My spring configuration gets this from system properties, like this:
>
>     <bean id="someDataSource" 
> class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
>         <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
>         <property name="url" 
> value="jdbc:mysql://127.0.0.1:3306/${sh.database.schema}"/>
>         ...
>     </bean>
>
> Is there a way to set these properties in server.xml for both instance 
> of my webapp? I plan on using 2 virtual hosts, something like blah.com 
> and development.blah.com, each would get it's own set of system 
> properties.
>
> I already tried using environment entries, like this:
>
> <Context ...>
>   ...
>   <Environment name="sh.database.schema" value="shproduction" 
> type="java.lang.String" override="false"/>
>   ...
> </Context>
>
> However, these aren't picked up by Spring.
>
> How would I do this?
>
> Regards,
>
> bas.
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org