JAN's History
[Spring]required a bean of type 'org.springframework.security.oauth2.client.registration.ReactiveClientRegistrationRepository' that could not be found. 본문
Error zip
[Spring]required a bean of type 'org.springframework.security.oauth2.client.registration.ReactiveClientRegistrationRepository' that could not be found.
JANNNNNN 2024. 5. 30. 13:25상황
저는 application.yml을 사용했습니다!
[기존 yml 설정파일]
server:
port: 8080
servlet:
context-path: /
encoding:
charset: utf-8
enabled: true
spring:
mvc:
view:
prefix: /WEB-INF/views/
suffix: .jsp
datasource:
url: jdbc:mysql://localhost:3306/new_insta?serverTimezone=Asia/Seoul
driver-class-name: com.mysql.cj.jdbc.Driver
username: new_insta
password: 1234
jpa:
open-in-view: true
hibernate:
ddl-auto: update #Create, update, none
naming:
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
show-sql: true
servlet:
multipart:
enabled: true
max-file-size: 2MB
security:
user:
name: test
password: 1234
oauth2:
client:
registration:
facebook:
client-id: your_id
client-secret: your_number
scope:
- public_profile
- email
file:
path: C:/workspace/springbootwork/upload/
이 상태로 페이스북 연동 로그인을 진행하려고 하는데 갑자기 ...
required a bean of type 'org.springframework.security.oauth2.client.registration.ReactiveClientRegistrationRepository' that could not be found.
Error 발생 ..ㅠㅠ
해결방안
처음에는 찾아보니까 include oauth를 하면 된다고 하셔서 저도 해봤는데요..
server:
port: 8080
servlet:
context-path: /
encoding:
charset: utf-8
enabled: true
spring:
mvc:
view:
prefix: /WEB-INF/views/
suffix: .jsp
datasource:
url: jdbc:mysql://localhost:3306/new_insta?serverTimezone=Asia/Seoul
driver-class-name: com.mysql.cj.jdbc.Driver
username: new_insta
password: 1234
jpa:
open-in-view: true
hibernate:
ddl-auto: update #Create, update, none
naming:
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
show-sql: true
servlet:
multipart:
enabled: true
max-file-size: 2MB
security:
user:
name: test
password: 1234
profiles:
include: oauth //<- 이부분 추가
oauth2:
client:
registration:
facebook:
client-id: your_id
client-secret: your_number
scope:
- public_profile
- email
file:
path: C:/workspace/springbootwork/upload/
또 같은 에러가 발생했답니다 ㅠㅠ
그래서 다시 찾아보니까 들여쓰기의 문제였어요!
그리고 oauth2는 security 안에 들어있어야 했더라구요
server:
port: 8080
servlet:
context-path: /
encoding:
charset: utf-8
enabled: true
spring:
mvc:
view:
prefix: /WEB-INF/views/
suffix: .jsp
datasource:
url: jdbc:mysql://localhost:3306/new_insta?serverTimezone=Asia/Seoul
driver-class-name: com.mysql.cj.jdbc.Driver
username: new_insta
password: 1234
jpa:
open-in-view: true
hibernate:
ddl-auto: update #Create, update, none
naming:
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
show-sql: true
servlet:
multipart:
enabled: true
max-file-size: 2MB
security:
user:
name: test
password: 1234
oauth2: //<-위치를 security안으로 수정! 들여쓰기도 알맞게 수정!
client:
registration:
facebook:
client-id: 387833254211507
client-secret: 946a76bb3727eaee790f76b5d54c6ca0
scope:
- public_profile
- email
profiles: //<-이건 그냥 혹시 몰라서 안지웠어요
include: oauth
file:
path: C:/workspace/springbootwork/upload/
그래서 oauth의 위치와 profiles : include:oauth까지 해서 에러가 해결되었답니다
비교적 빠르게 해결된 에러 ..ㅎㅎ