restructuring code so that the provider bean is available to the api module