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
Apologies if this isn't the right place to ask this but I'm stuck on the following scenario:
I have a class that initialises a container and do the following:
this.container.load(buildProviderModule());
In my bootstrap class I try to get a service class from the container:
const applicationContext: ApplicationContext = new ApplicationContext();
const container = applicationContext.iocContainer();
const server = new InversifyExpressServer(container);
server.setConfig((app) => {
const keycloakService: KeycloakService = container.get(TYPE.KeycloakService);
app.use(keycloakService.middleware());
app.use(bodyParser.urlencoded({
extended: true,
}));
app.use(bodyParser.json());
});
When I start my bootstrap class I get the following exception:
Error: No matching bindings found for serviceIdentifier: Symbol(KeycloakService)
at _validateActiveBindingCount (/Users/aminmc/Development/typescript-example/node_modules/inversify/lib/planning/planner.js:62:23)
If I explicitly add the class to the container then it works.
@provide(TYPE.KeycloakService)
export class KeycloakService {
..
}
It looks as though the KeycloakService hasn't been registered by the time I call the container to get the class. The Keycloak Service resides in a different package from the ApplicationContext class where I initialise the container.
Is there a way force the container to be initialised before I call the container to get the class? Or am I missing a set up method?
Any help would be appreciated.
The text was updated successfully, but these errors were encountered:
Hello,
Apologies if this isn't the right place to ask this but I'm stuck on the following scenario:
I have a class that initialises a container and do the following:
In my bootstrap class I try to get a service class from the container:
When I start my bootstrap class I get the following exception:
If I explicitly add the class to the container then it works.
My service class looks
It looks as though the KeycloakService hasn't been registered by the time I call the container to get the class. The Keycloak Service resides in a different package from the ApplicationContext class where I initialise the container.
Is there a way force the container to be initialised before I call the container to get the class? Or am I missing a set up method?
Any help would be appreciated.
The text was updated successfully, but these errors were encountered: