Currently, MessageDispatcherServlet only uses standard bean names for message factory and message receiver.
This is problematic since there is may be name collisions. Another problem is that if I want to use the same application context with two servlerts mapped on different URIs, there is no way I can tell them which message receivers they have to use.
Both problems can be solved with separate application context per servlet, but this rather complicated.
Why not allow these bean names to be configured, with pre-configured names set by default?
I mean, we could add:
The name will be MESSAGE_RECEIVER_BEAN_NAME (as usual) by default. But in case the someone need to access the bean with another name, it can be done as simple as:
I will also attach the modified class I use in my project.
Had to copy-paste instead of subclassing since all the init* methods are private, not protected...