This is getting a little off-topic, but I feel obliged to mention that we 
recently open sourced our generalized solution for dealing with the problem of 
environmental-specific Spring configuration, known as BoxSpring. Our experience 
with both Spring and our prior DI container lead to the conclusion that 
property placeholder was not a suitable solution. You can read the details of 
this project at http://www.box-spring.org/.
 
Justin

________________________________

From: Mohan KR [mailto:kmoh....@gmail.com]
Sent: Sat 7/11/2009 1:31 PM
To: 'Maven Users List'
Subject: RE: maven spring eclipse and properties/spring config



Yup, that is a decision you have to make. But in general, the approach I
have been using is
this:
- You spring-context files rarely should be different for each environment
(if you think hard enough, you
  can achieve it :)).
- We externalize all environment specific information from Spring Context
files as properties and use
  Spring PPC (property placeholder) to substitute the relevant values during
the Bean Factory lifecycle.
- You can do all the resource filtering (maven) on *those* properties files
above that are externalized.
  
It will take a very long message or an article to show an example :), but
information above should get
you going, I hope.

Thanks,
mohan kr

-----Original Message-----
From: Tim O'Brien [mailto:tobr...@discursive.com]
Sent: Saturday, July 11, 2009 11:03 AM
To: Maven Users List
Subject: Re: maven spring eclipse and properties/spring config

On Fri, Jul 10, 2009 at 1:54 PM, Vincent Fumo<neo...@gmail.com> wrote:
> I'm converting an old project to maven and I have a question re: spring.
> This project has about 20 spring config files and it reads them all in on
> startup and uses the  In addition I have 4 properties files
> (local/dev/qa/prod) that I'd like to use to inject/filter/substitute
values
> into them depending on the build. Lastly I am using the eclipse plugin to
> generate an eclipse project.
> What I need to know is the following :
>
> 1) where should I put the spring files? I am considering
> src/main/resources/spring

If you load them from the classpath, put them in src/main/resources.
By default everything in this directory will end up in target/classes
(if your project uses a packaging of "jar")

> 2) how should I best filter the props files? Should I use maven for this
> (using profiles in some way), or should I load the files in the app and
use
> the spring properties configurator?

I don't think anyone on this list is qualified to make this
architectural decision for you.   But, if you wanted to use Maven
Resource filtering, you could.     You would have a single properties
file:  whatever.properties which would contain references to arbitrary
properties such as "${whatever.jdbc.url}", then you would use profiles
and configure resource filtering on this properties file.

> 3) what is the best way to use the eclipse plugin to generate a project
> where I can run the app and it can see the newly filtered spring files
> (instead of the src ones)?
>

m2eclipse is going to automatically call "process-resources
resources:testResources" every time you change a resource and copy the
result to target/classes.     You can control the profile via your
project's Maven preferences in m2eclipse.


> Can anyone help me out? I'd certainly give more info if needed.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



Reply via email to