mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java
public static <ViewModelType extends ViewModel> void initializeViewModel(ViewModelType viewModel) {
        if (viewModel == null) {
            return;
        }

        final Collection<Method> initializeMethods = getInitializeMethods(viewModel.getClass());

        initializeMethods.forEach(initMethod -> {
			// if there is a @PostConstruct annotation, throw an exception to prevent double injection
            final boolean postConstructPresent = Arrays.stream(initMethod.getAnnotations())
                    .map(Annotation::annotationType)
                    .map(Class::getName)
                    .anyMatch("javax.annotation.PostConstruct"::equals);

            if(postConstructPresent) {
				throw new IllegalStateException(String.format("initialize method of ViewModel [%s] is annotated with @PostConstruct. " +
						"This will lead to unexpected behaviour and duplicate initialization. " +
						"Please rename the method or remove the @PostConstruct annotation. " +
						"See mvvmFX wiki for more details: " +
						"https://github.com/sialcasa/mvvmFX/wiki/Dependency-Injection#lifecycle-postconstruct", viewModel));
			}

			ReflectionUtils.accessMember(initMethod, () -> initMethod.invoke(viewModel), "mvvmFX wasn't able to call the initialize method of ViewModel [" + viewModel + "].");
		});
    }
public static <ViewModelType extends ViewModel> void initializeViewModel(ViewModelType viewModel) {
        if (viewModel == null) {
            return;
        }

        final Collection<Method> initializeMethods = getInitializeMethods(viewModel.getClass());

        initializeMethods.forEach(initMethod -> {
			// if there is a @PostConstruct annotation, throw an exception to prevent double injection
            final boolean postConstructPresent = Arrays.stream(initMethod.getAnnotations())
                    .map(Annotation::annotationType)
                    .map(Class::getName)
                    .anyMatch("javax.annotation.PostConstruct"::equals);

            if(postConstructPresent) {
				throw new IllegalStateException(String.format("initialize method of ViewModel [%s] is annotated with @PostConstruct. " +
						"This will lead to unexpected behaviour and duplicate initialization. " +
						"Please rename the method or remove the @PostConstruct annotation. " +
						"See mvvmFX wiki for more details: " +
						"https://github.com/sialcasa/mvvmFX/wiki/Dependency-Injection#lifecycle-postconstruct", viewModel));
			}

			ReflectionUtils.accessMember(initMethod, () -> initMethod.invoke(viewModel), "mvvmFX wasn't able to call the initialize method of ViewModel [" + viewModel + "].");
		});
    }
If a ViewModel has a method annotated with {@link Initialize}
or method with the signature <code>public void initialize()</code>
it will be invoked. If no such method is available nothing happens.

@param viewModel
the viewModel that's initialize method (if available) will be
invoked.
@param <ViewModelType>
the generic type of the ViewModel.