java - Best Practice / best design choice considering runtime configurationtype application wide -


i'd consider configurationtype of webapplication (deployment / development) switch functionality of many modules in webapplication between live , test behavior.

for example, there modules provide payment services , need switch api configuration between live , sandbox. id decide based on webapplications configuration type. providing example method like:

public boolean isruntimeconfigurationtypedeployment() {         return getconfigurationtype().equals(runtimeconfigurationtype.deployment);     } 

in applications class, can call through wicket pages. instead of leaving responsibility switch behavior wicket components itself, better manage these decision centralized. decisions need made in many different places, wonder best practice design architecture.

another practical example: button manually commit orders fullfillment center within administration frontend

public void onclick(ajaxrequesttarget target) {                 if(getshopadminapplication().isruntimeconfigurationtypedeployment())                     export.fullfillment().send();                 else {                     exportmock.fullfillment().send();                 }             } 

i use single service provides runtime mode (dev, prod, uat, etc). , service (spring configuration) different kind of ioc depending on mode. avoid checking mode components. ioc should done @ startup , components should work same, no matter if it's prod or test. try replace implementation of components test.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -