아래처럼 코드를 `import org.springframework.web.filter.CorsFilter;`를 통해 정상적으로 빈 등록을 했는데 계속 아래처럼 오류가 뜨네요..
package com.example.jwttutorial.config;
import org.springframework.web.filter.CorsFilter;
...
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class SecurityConfig extends WebSecurityConfigurerAdapter {
private final CorsFilter corsFilter;
...
public SecurityConfig(
CorsFilter corsFilter,
...
) {
...
}
}
}
2022-05-18 19:09:09.191 ERROR 58636 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPLICATION FAILED TO START *************************** Description: Parameter 1 of constructor in com.example.jwttutorial.config.SecurityConfig required a bean of type 'org.springframework.web.filter.CorsFilter' that could not be found. Action: Consider defining a bean of type 'org.springframework.web.filter.CorsFilter' in your configuration.
또, Application 클래스에
@SpringBootApplication(scanBasePackages = {"org.springframework.web.filter.CorsFilter"})를 붙이면 되네요..