Error configuring myBatis for Spring Boot

I have the following snippet for configuring myBatis:

@Configuration
public class MyBatisConfiguration {

    @Autowired
    private ProcessEngine processEngine;

    public Properties getSqlSessionFactoryProperties(ProcessEngineConfigurationImpl conf) {
        Properties properties = new Properties();
        ProcessEngineConfigurationImpl.initSqlSessionFactoryProperties(properties,
                conf.getDatabaseTablePrefix(), conf.getDatabaseType());

        return properties;
    }

    @Bean
    public SqlSessionFactory createMyBatisSqlSessionFactory() {

        InputStream config = getFileFromResourceAsStream("myBatisProcessInstanceMapper.xml");

        ProcessEngineConfiguration processEngineConfiguration = processEngine.getProcessEngineConfiguration();
        DataSource dataSource = processEngineConfiguration.getDataSource();

        TransactionFactory transactionFactory = new ManagedTransactionFactory();
        Environment environment = new Environment("customTasks", transactionFactory, dataSource);

        XMLConfigBuilder parser = new XMLConfigBuilder(
                config,
                "", // set environment later via code
                getSqlSessionFactoryProperties((ProcessEngineConfigurationImpl) processEngineConfiguration));

        org.apache.ibatis.session.Configuration configuration = parser.getConfiguration();
        configuration.setEnvironment(environment);

        configuration = parser.parse();

        configuration.setDefaultStatementTimeout(processEngineConfiguration.getJdbcStatementTimeout());

        SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(configuration);
        return sqlSessionFactory;
    }

    private InputStream getFileFromResourceAsStream(String fileName) {

        // The class loader that loaded the class
        ClassLoader classLoader = getClass().getClassLoader();
        InputStream inputStream = classLoader.getResourceAsStream(fileName);

        // the stream holding the file content
        if (inputStream == null) {
            throw new IllegalArgumentException("file not found! " + fileName);
        } else {
            return inputStream;
        }

    }
    }

I am getting NullPointerexception for configuration = parser.parse();.

Note:

  1. myBatisProcessInstanceMapper.xml is in src/main/resources folder