FOREST_CHOI's BLOG

java.lang.UnsupportedOperationException: public abstract java.lang.String javax.servlet.ServletRequest.getRemoteAddr() is not supported 본문

프로그래밍/Spring Boot

java.lang.UnsupportedOperationException: public abstract java.lang.String javax.servlet.ServletRequest.getRemoteAddr() is not supported

Forest_Choi 2022. 10. 2. 01:29
728x90

마이크로 서비스 관련 강의를 듣던 도중 Spring Cloud Config 를 설정하는 부분에서 오류가 발생했다.

 

원인은 yaml파일의 IP addr와 user-micro-service에 작성한 IP address 가 서로 다르기 떄문에 발생하였다.

  - 회사에서 공부하는데, 집, 회사 IP가 다르니까 당연한 것이다.

http.authorizeRequests().antMatchers("/**")
    .hasIpAddress("{ ip address  }")
    .and()
    .authenticationManager(authenticationManager)
    .addFilter(getAuthenticationFilter(authenticationManager));

 

token:
  expirationTime: 86400000
  secret: dbgkdus_tkfkdgo_dnfltkfkdduddnjsgkwk

gateway:
  ip: {  IP  Address   }

java 코드와 yaml 코드에서 의 IP정보를 동일하게 맞춰주면 해결이된다.

728x90

'프로그래밍 > Spring Boot' 카테고리의 다른 글

Spring MVC?  (0) 2022.10.15
Spring?  (0) 2022.10.15
포트번호 가져오기  (0) 2022.09.27
Relying upon circular references is discouraged and they are prohibited by default. ....  (0) 2022.09.27
WebSecurityConfigurerAdapter  (0) 2022.09.22
Comments