class SpringParamEngineFactory implements FactoryBean<ParamEngine>, ApplicationContextAware {

    @Override
    public ParamEngine getObject() {
        ParamEngineConfigBuilder configBuilder = ParamEngineConfigBuilder.paramEngineConfig();
        if (paramRepository != null) {
            configBuilder.withParameterRepositories(paramRepository);
        }

        configBuilder.withPackagesToScan(new PackageList(packagesToScan));
        if (!scanAnnotations) {
            configBuilder.withAnnotationScanDisabled();
        }

        configBuilder.registerModule(new SpringModule(appContext));

        return new ParamEngineFactory().createParamEngine(configBuilder.build());
    }

}