Spring boot 버전을 2.1.6에서 Spring boot 2.4로 마이그레이션하는 동안 following 오류 발생
프로젝트를 Spring boot 버전 2.1.6에서 2.4로 마이그레이션하는 동안 following 오류가 발생
{*...} 이후에는 패턴 데이터가 더 이상 허용되지 않습니다.} 또는 **패턴요소
오류가 발생하는 코드 스니펫
public class WebConfig implements WebMvcConfigurer {
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(authInterceptor)
.addPathPatterns("/**/test/**")
}
}
Spring boot가 버전 2.4에서 AntPathMatcher를 비활성화하는 것을 알고 있어서 이 옵션도 시도해 보았습니다.
스프링.mvc.path패턴.매칭-전략=ant_path_matcher
하지만 이마저도 효과가 없습니다.
도움을 주시면 대단히 감사하겠습니다.
springdoc-openapi-ui의 최신 버전 1.5.12로 문제가 해결되었습니다.
이유:이 오류는 경로 와일드카드 문제입니다.검색 결과 스프링을 5.3으로 업그레이드한 후 경로 와일드카드가 변경되었습니다.공식 설명은 "Spring MVC에서는 기존에 앤트패스매처(AntPathMatcher)에서 경로를 분석했지만, Spring 5.3.0부터 WebFlux에서 도입된 경로패턴파서(PathPatternParser)를 사용하도록 변경했습니다"입니다.
해결책: 구체적인 해결책은 변화하는 것입니다./**/*.css
로./*/*.css
. 프로젝트에 여러 파일이 관련되어 있을 수 있으며 파일을 변경해야 합니다.
application.properties에서 설정합니다.패턴을 수정하거나 둘 중 하나입니다.
spring.mvc.path match.spring-mvc=ant_path_matcher
Spring의 최신 버전에서는 올바른 속성이 다음과 같습니다.spring.mvc.pathmatch.matching-strategy
(그렇지 않음)spring.mvc.pathpattern.matching-strategy
)
자세한 정보 : https://docs.spring.io/spring-boot/docs/current/reference/html/application-properties.html#application-properties.web.spring.mvc.pathmatch.matching-strategy
관련 이슈 : https://github.com/spring-projects/spring-boot/issues/28791
CAPS를 사용하면 효과가 있는 것 같습니다.
spring.mvc.pathmatch.matching-strategy=ANT_PATH_MATCHER
언급URL : https://stackoverflow.com/questions/66118420/getting-following-error-while-migrating-spring-boot-version-from-2-1-6-to-spring
'programing' 카테고리의 다른 글
OnclientClick과 OnClick이 동시에 작동하지 않습니까? (0) | 2023.09.15 |
---|---|
WordPress 설명이 있는 사용자 지정 게시 유형 아카이브 (0) | 2023.09.15 |
단일 레이블에 여러 글꼴 색 사용 (0) | 2023.09.15 |
빈 값을 정수 필드로 저장하는 방법 (0) | 2023.09.15 |
유효성 확인 후 후 주문 전에 Woocmerce 체크아웃에서 만들기 (0) | 2023.09.15 |