Spring Beans not Instantiating

I had not seen this error before:

No qualifying bean of type 'org.springframework.security.oauth2.client.registration.ClientRegistrationRepository' available

It took a little bit of research to find that if you do not have your application.yaml with the Spring Security section for this bean, it will not be able to instatiate one and you get the error.

To make it more difficult, I was specifying this module in gradle and I was expecting things to work. Asuming…

Once I added:

spring:
  security:
    oauth2:
      client:
        registration:
          nameItSomething:
            authorization-grant-type: client_credentials
            client-id: clientNameYouHave
            client-secret: DontShareYourSecretOnTheInternet
        provider:
          nameItSomething:
            token-uri: https://oidcServer/protocol/openid-connect/token

That ClientRegistrationRepository bean started to have a life.

Next bean… Same… I need to add a section for the caching in my application.yaml.

Published by

m5c

Java developper that loves photography and an excellent espresso

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s