- o - Gotchas - o -
Every programming solutions got one. This one also. With current
@Configurable implementation services get injected AFTER the injectee is
created (after all constructors got invoked). That means this won't work:
> public class LeaguePage extends BaseSquasherPage {
> private LeagueService leagueService;
>
> public LeaguePage( PageParameters parameters ) throws StringValueConversionException {
> Long leagueId = parameters.getLong( "id" );
>
> // nasty NPE here!
> League league = leagueService.loadLeague( leagueId );
>
> add( new Label( "leagueName", league.getName() ) );
> }
> }
Why is that?
did you look what the did change in the byte codes?
At what point do they really do the injection?
johan
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ Wicket-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-user
