'java.lang.NoSuchMethodError: org.springframework.web.cors.CorsConfiguration.addAllowedOriginPattern

I found a security vulnerability during the sonatype library scan in spring-beans and spring-context 5.2.12.Release version. But when I upgraded its parent library spring-webmvc to 5.3.14 to get rid of the vulnerability I got a new runtime error java.lang.NoSuchMethodError: org.springframework.web.cors.CorsConfiguration.addAllowedOriginPattern.



Solution 1:[1]

Resolved by upgrading spring-web and restricting it to a specific version

implementation (group: 'org.springframework', name: 'spring-web' ) {
        version{
            strictly '5.3.20'
        }
    }

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 akarahman