Only Component and Behavior instances support auto-inject.
You need to call: Injector.get().inject(this) in the constructor of any
other type.


On Thu, Dec 27, 2012 at 12:56 PM, wicket_new_user <murthy.m...@gmail.com>wrote:

> Hi,
> i've written a new custom validator and trying to Inject one bean which is
> resulting in an error
>
> org.apache.wicket.WicketRuntimeException: Exception 'null' occurred during
> validation
> com.foo.CustomNameValidation on component 3:report:name
>
> My piece of code is below
> ====================
> public class CustomNameValidation implements IValidator<String>
> {
>     @SpringBean
>     private IReportDAO reportDAO;
>
>     @Override
>     public void validate(IValidatable<String> validatable)
>     {
>         final String reportName = validatable.getValue();
>
>         if (*/reportDAO/*.findByReportName(reportName) > 0L)
>         {
>             validatable.error(new
> ValidationError().addMessageKey("reportNameAlreadyExists"));
>         }
>     }
> }
> ==============================
>
> I'm unable to understand what is missing from the above to get the
> "reportDAO" as null
>
> thanks
>
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/SpringBean-issue-in-CustomValidator-tp4655081.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Reply via email to