Java – wicket @ springbean cannot create bean
•
Java
I have an eclipse, wicket, spring, hibernate project Everything is normal except when I try
public class SortableContactDataProvider extends SortableDataProvider<User> { @SpringBean private Service service; public Iterator<User> iterator(int first,int count) { //SortParam sp = getSort(); return service.findAllUsers().subList(0,15).iterator(); } ...
Service variable is null? Anywhere else, when I use this construct "service" is not empty and works well Please help me solve this problem
Solution
@Springbean applies only to any subclass of a component
You need to do the following in the constructor
Small door 1.4
InjectorHolder.getInjector().inject(this);
Small door 1.5
org.apache.wicket.injection.Injector.get().inject(this);
See 'generic idataprovider implementation'@ http://stronglytypedblog.blogspot.com/2009/03/wicket-patterns-and-pitfalls-1.html
Please enjoy
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码