You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using Weld as DI framework it is possible to annotate a method with @PostConstruct to make Weld call this method after intantiation.
I accidentally named this method "initialize" which collides with a feature of FluentViewLoader. This method is called twice. Weld calls it because of @PostConstruct and the FluentViewLoader calls it because of its name.
This feature should be documented more clearly. Would it be possible to throw an exception when this constellation appears? It would avoid a lot of headache ;-)
The text was updated successfully, but these errors were encountered:
We should throw an exception in this case with a message that asks the user to rename the post-construct method. This is better then silently include a hack that only calls the initialize method once in this case. We will address this in the next main version
There is another problem with the initialize method in view model. If you make your view model class package private or the initialize method private you get an error. JavaFX is able to call the initialize method in the view class if the visibility is not public.
I think you have to call "initializeMethod.setAccessible(true);" in JavaViewLoader before invoking the method.
Hi,
there is already an issue with this feature request (#332) and a discussion on possible solutions for this.
I think we shouldn't mix it with this issue here. For this reason I will close this issue now and we can discuss in #332 about your request (or if you think it's a different issue, you can create a new one?)
When using Weld as DI framework it is possible to annotate a method with @PostConstruct to make Weld call this method after intantiation.
I accidentally named this method "initialize" which collides with a feature of FluentViewLoader. This method is called twice. Weld calls it because of @PostConstruct and the FluentViewLoader calls it because of its name.
This feature should be documented more clearly. Would it be possible to throw an exception when this constellation appears? It would avoid a lot of headache ;-)
The text was updated successfully, but these errors were encountered: