wood burning stoves 2.0*
The moose likes Spring and the fly likes Production code and Development code/settings must different Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Production code and Development code/settings must different" Watch "Production code and Development code/settings must different" New topic
Author

Production code and Development code/settings must different

Charles Roos
Greenhorn

Joined: Dec 14, 2012
Posts: 5
My project has a XML file "views.properties", that needs to have different content for Production environment and different content when in Development mode. How can i achieve that?

I understand that Java does not have pre-compiler directives (like #ifdef and others). But if Java had such possibility i would do in file "views.properties" so:

#ifdef Production Then

decisionIType.(class) = ee.vet.tkis.domain.pdf.DecisionITypeView
decisionIType.contentType = application/pdf;charset=UTF-8
decisionIType.stylesheetLocation = file:\\\C:\\ProductionFolder\\xsl\\decisionsIType.xsl

#else

decisionIType.(class) = ee.vet.tkis.domain.pdf.DecisionITypeView
decisionIType.contentType = application/pdf;charset=UTF-8
decisionIType.stylesheetLocation = file:\\\C:\\DevelopmentFolder\\xsl\\decisionsIType.xsl

#endif


I connect to file "views.properties" with a Spring bean automatically so in a xml file (by setting property "basename"="views" which makes connection to "views.properties"):



If pre-compiler directives were allowed there, then i perhaps also could there write if-else to determine if to load file "viewsProduction.properties" or "viewsDevelopment.properties".

My overall goal is to have file "views.properties" different when in Production mode and when in Development mode.
What do you suggest?
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1648
    
    7

Use Spring profiles

http://blog.springsource.com/2011/02/11/spring-framework-3-1-m1-released/


[How To Ask Questions][Read before you PM me]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Production code and Development code/settings must different