my System consists of many subSystems ,and some of them need to use different queue which are binded to different exchang by using different key.I want to design them like that queues ,exchange and key can be configured in properties file,and user can not be care the key value and exchange.I have write some code as follows
Code:
@Component
public class ClientSendService {
	@Resource(name = "projectExechange")
	private Exchange projectExchange;
	@Autowired
	private RabbitTemplate rabbitTemplate;
	@Autowired
	private RabbitAdmin admin;

	/**
	 * process message format
	 */
	@Autowired
	MessageProcessor messageService;
	@Value(value = "${rabbit.default.key}")
	private String requestCommand;

	/**
	 * init  binding
	 */
	@PostConstruct
	public void initConifg() {
		admin.declareExchange(projectExchange);

	}

	/**
	 * send message to default queue 
	 * 
	 * @param messageData
	 * @throws AmqpException
	 * @throws Exception
	 */
	public void sendMessageToQueue(MessageDataTransObject messageData)
			throws AmqpException, Exception {
		this.sendMessageToQueue(requestCommand, messageData);
	}

	/**
	 * send message to  the assigned queue
	 * 
	 * @param key
	 * @param messageData
	 * @throws AmqpException
	 * @throws Exception
	 */
	public void sendMessageToQueue(String key,
			MessageDataTransObject messageData) throws AmqpException, Exception {
		rabbitTemplate.convertAndSend(projectExchange.getName(), key,
				messageData, new MessagePostProcessor() {

					@Override
					public Message postProcessMessage(Message message)
							throws AmqpException {
						return messageService.processMessage(message);

					}
				});
	}
at first I thount this can be common Class in different subsystem.but today there is a subsystem needs to integrate other subsystem,unfortunately,the two subsystem all use the rabbitmq ,and has the common configurations about mq,that is to say they have conflict in dependicies injection, one of the system configuration as follows
Code:
<rabbit:queue id="defaultQueue" name="${rabbit.default.queue}" />
	<rabbit:direct-exchange
        id="projectExechange"
        name="staticfileBackstageExchange" >
        <rabbit:bindings>
            <rabbit:binding
                key="${rabbit.default.key}"
                queue="defaultQueue" >
            </rabbit:binding>
        </rabbit:bindings>
    </rabbit:direct-exchange>
so I want to get the answers about how to design the system ,so that it can make system Low coupling,and the key,queue,exchange don't need to be written in your code ,and they can be integrated with no conflict.
Thank you very much.