Absolutely. You should have some sort of an interface that your service layer uses, then you can change the implementation at any time, so long as it implements the same interface it should be interchangeable.
That's the benefit of interfaces and DI, especially using a container such as Spring. Once you change the implementation, just configure spring to use the new one and away you go.
===============
Update cause the comments are too small:
Well I guess that all depends on your service. The thing is, that if you use an interface (say over top of NServiceBus), you can always create an Adapter to plug your WCF implementation into the interface.
For example:
public interface IService {
void DoSomething();
}
public class NServiceBusService : IService {
public void DoSomething() {
//Some NServiceBusCode
}
}
Now (I'm guessing, I'm not very familiar with spring.net), you can have Spring use the NServiceBusService as the implementation of IService.
And now you decide to plug in WCF instead? You could just have a WCF Implementation:
public class WCFService : IService {
public void DoSomething() {
//Some WCF Code
}
}
And now you can set up Spring to use WCFService for IService instead of NServiceBusService.
Or, if your WCFService doesn't match the signature for the IService, as in maybe it looks like:
public class WCFService {
public void DoSomethingWCFStyle() {
//Some WCF Code
}
}
Then you could just use the adapter pattern to make that work:
public class WCFServiceAdapter : IService {
private WCFService wcfService;
public WCFServicAdapter(WCFService wcfService) {
this.wcfService = wcfService;
}
public void DoSomething() {
wcfService.DoSomethingWCFStyle();
}
}
No matter what, there are ways for you to inject that dependency. The hard part is that you need to set up the contract using your interface and your objects must abide by that contract, otherwise you're going to have trouble. But there's always a way to map (for example, using the adapter pattern above) the objects to look like they implement the interface and make it work.