You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Vincent Fumo <ne...@gmail.com> on 2009/07/10 22:54:15 UTC

maven spring eclipse and properties/spring config

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
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?
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)?

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

RE: maven spring eclipse and properties/spring config

Posted by "Edelson, Justin" <Ju...@mtvstaff.com>.
ASL 2. Listed correctly here: http://kenai.com/projects/boxspring, but
didn't make it into the site build.

Justin

-----Original Message-----
From: Brett Randall [mailto:javabrett@gmail.com] 
Sent: Monday, July 13, 2009 2:51 AM
To: Maven Users List
Subject: Re: maven spring eclipse and properties/spring config

Hi Justin,

What is the license?  http://www.box-spring.org/license.html doesn't yet
list one .

Brett

Edelson, Justin wrote:
> 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.raj@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:tobrien@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<ne...@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-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
>
>   


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


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


Re: maven spring eclipse and properties/spring config

Posted by Brett Randall <ja...@gmail.com>.
Hi Justin,

What is the license?  http://www.box-spring.org/license.html doesn't yet 
list one .

Brett

Edelson, Justin wrote:
> 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.raj@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:tobrien@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<ne...@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-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
>
>   


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


RE: maven spring eclipse and properties/spring config

Posted by "Edelson, Justin" <Ju...@mtvstaff.com>.
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.raj@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:tobrien@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<ne...@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-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


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




RE: maven spring eclipse and properties/spring config

Posted by Mohan KR <km...@gmail.com>.
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:tobrien@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<ne...@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-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


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


Re: maven spring eclipse and properties/spring config

Posted by Tim O'Brien <to...@discursive.com>.
On Fri, Jul 10, 2009 at 1:54 PM, Vincent Fumo<ne...@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-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org