Hi,
I would like to know if is possible to use generics with BeanFactory and how to use it?
thank's
Moa.
Hi,
I would like to know if is possible to use generics with BeanFactory and how to use it?
thank's
Moa.
Moa
\"With no walls and fences on Linux who needs Windows and Gates\"
Moa,
Most of Spring's code is written to run on Java 1.3 so you won't be able to take advantage of any generics features with most of Spring codebase. Some specific features are written for 1.4 or 1.5 but as yet there is no generics support in the API.
Rob
Hi Robh, thank's for the fast answer.
Just one last question, do you know when this feature will be implemented?
bye.
Moa
\"With no walls and fences on Linux who needs Windows and Gates\"
No plans as yet to make Spring dependent on Java 1.5 and its probably not something you will see for some time. We are committed to making sure that the widest range of users can take advantage of Spring so we will continue to support Java 1.3 for the forseeable future.
Rob
Hello robh,
it about 3 years ago from your post. Does spring now supports generics?
Greetings
astrapi
Spring always supported generics, in a certain way. What exactly do you want to do?
Hi dejanp,
here is my code:
package beans;
import service.AbstractBusinessService;
public interface AbstractBackingBean<E, BB, SR, SF> {
public E getDomainObject();
public BB getBusinessBean();
public AbstractBusinessService <E, SR, SF> getBusinessService();
public void setDomainObject(E pDomainObject);
}
______________________________________________
package generics;
import java.util.List;
import service.AbstractBusinessService;
public class GenericBackingBean<E, BB, SR, SF> {
private Class<E> entity;
private Class<BB> bb;
private Class<SR> sr;
private Class<SF> sf;
private AbstractBusinessService<E, SR, SF> abs;
public GenericBackingBean(Class<E> entity, Class<BB> bb, Class<SR> sr, Class<SF> sf) {
this.entity = entity;
this.bb = bb;
this.sr = sr;
this.sf = sf;
}
public void saveEntity(E entity) {
abs.saveVersion(entity);
}
public List<SR> findBySearchFilter(SF searchBean) {
return abs.findBySearchFilter(searchBean);
}
}
_____________________________________________
My Question:
How do I define the Class in the applicationContext.xml?
<bean id="myBackingBean" class="generics.GenericBackingBean">
<constructor-arg>
<value>domain.Person</value>
<value>beans.BusinessBean</value>
<value>beans.SearchResultBean</value>
<value>beans.SearchBean</value>
</constructor-arg>
</bean>
Does it work like that?
No i have problem with the "value"-Element in the "constructor-arg"-Element.
How do i make this in Spring?
Post the stacktrace of the error please.