The spring-beans.dtd does not allow the use of both constructor-based and setter-based injection in the same bean, i.e
Not knowing about this restriction, I created a couple beans that mixed both approaches and they worked fine. Both the c'tor args and the properties were set. This was using Spring 1.1.2; don't know about other versions. The application context was loaded via the ContextLoaderListener and XmlWebApplicationContext.<!ELEMENT bean (
description?,
(constructor-arg | property)*,
(lookup-method)*,
(replaced-method)*
)>
My problem is that our XML tools complain about my configuration file since it violates the DTD.
IMHO mixing both dependency injection approaches are valid. If the Spring code can handle this, can the DTD be changed?


Reply With Quote