Spring Framework DelegatingMessageSource - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework DelegatingMessageSource class.

This code example shows how to use the following methods:setParentMessageSource
	 * Create a new {@link DefaultObjectMessageSource} instance with the specified parent. 
	 * @param parent the parent message source. 
	public DefaultObjectMessageSource(MessageSource parent) {
		Assert.notNull("Parent must not be null");
	public String getMessage(Object object, Object[] args, Locale locale) throws NoSuchObjectMessageException {
		String message = getFullyResolvedMessage(object, args, locale, false);
		if (message == null && object != null) {
			throw new NoSuchObjectMessageException(object, locale);
		return message;
	 * Returns a fully resolved message, includes resolving any message parameters. 
This code example shows how to use the following methods:
        IEmployee target = new Employee();
        this.callback = new DefaultErrorRenderingCallback();    
        this.errors = new BindException(target, "command");
        this.errors.addError(new ObjectError("command", new String[]{"ErrorCode1"}, null, "Default Message 1"));
        this.messageSource = new DelegatingMessageSource();
    public void testGetRenderingComponent() throws Exception {
        Component component = this.callback.getRenderingComponent(this.errors.getGlobalError(), this.messageSource, new Locale("it"));
        assertXpathEvaluatesTo("Default Message 1", "//div", component.render());
    public void testGetRenderingAction() throws Exception {
        AjaxAction action = this.callback.getRenderingAction(this.errors.getGlobalError());
        String rendering = action.render();
        assertXpathExists("//script", rendering);
        assertTrue(rendering.indexOf("new Effect.Highlight(\"ErrorCode1\",{\"startcolor\":\"#FF0A0A\"});") != -1);
See Code Examples for Spring Framework DelegatingMessageSource Methods: