How Spring 3.1 Environments & Profiles will make your life better! | Developed
My goal of writing one technical blog post per week fell to the wayside around December mainly due to work related project time constraints. I have a four-day weekend and a sparkling new home office, which has to be used for something other than surfing hacker news. Its noon here and I have two hours to produce this blog post so here I go!
The software I write or design generally needs to be deployed in different configurations. These deployment configuration end points can be generalised into the following buckets
- Java Enterprise Containers (jboss, weblogic, tomcat, glassfish, etc)
- Standalone Java application
- GUI Applications
- Testing Frameworks
Ignoring GUI Applications for the moment (I might return to these later) the code is often the same between container, standalone and testing. This leads to a key design consideration or philosophy when designing and coding this "type" of software. The code I write needs to run perfectly and untainted in each scenario.
That's crucial to quality and robustness! The problem is that there are environmentally aware resources that are configured depending on where the code is executed. When I am writing a unit test I will not (I know I could, but I think you are missing the point) have my datasource bound to a JNDI tree. Where as in the container I simple lookup the tree and ask can I have a datasource please.
Read full article from How Spring 3.1 Environments & Profiles will make your life better! | Developed
No comments:
Post a Comment