我们希望为由Spring Boot Actuator提供的
我们尝试添加以下bean,但没有成功:
/health
端点的所有GET
请求启用CORS。我们尝试添加以下bean,但没有成功:
@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurerAdapter() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/health").allowedMethods("GET");
}
};
}
endpoints.cors.allowed-origins: "*"
,* 周围的引号很重要。翻译后的结果:To make it applicable for all sources, we setendpoints.cors.allowed-origins: "*"
in the .yml file. It is important to include the quotes around the * symbol. - Jon Erickson