@Id in PolymerTemplate Injects subtype to Field

Good Morning,

I’ve had this problem a few times and have just worked out that my PolymerTemplate class has a Div field annotated with @Id(“content”) and is being injected with a Bean that extends Div. See below for mockup.

@Tag("my-comp")
public class MyComp extends PolymerTemplate<TemplateModel> {

	@Id("content")
	Div content;

}

@SpringComponent
@UIScope
public class ComplexComponent extends Div {

}

When the TemplateInitializer runs it injects a ComplexComponent with UIScope to my field “content” in my PolymerTemplate class MyComp.
The SpringInstansiator is only finding the the ComplexComponent and not the superclass Div.

Thanks for your help.

Hayden

Hello.

Thanks for your feedback. I created an issue regarding the behavior you described: https://github.com/vaadin/spring/issues/344

If you have any additional information or corrections, please add a comment on the issue.

Best regards,

Tulio