|
- package com.ffii.tsms.config;
-
- import org.springframework.context.annotation.Bean;
- import org.springframework.context.annotation.Configuration;
- import org.springframework.http.MediaType;
- import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
- import org.springframework.web.servlet.config.annotation.CorsRegistry;
- import org.springframework.web.servlet.config.annotation.EnableWebMvc;
- import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
- import org.springframework.web.servlet.view.InternalResourceViewResolver;
-
- @Configuration
- @EnableWebMvc
- public class WebConfig implements WebMvcConfigurer {
-
- @Override
- public void addCorsMappings(CorsRegistry registry) {
- registry.addMapping("/**")
- .allowedHeaders("*")
- .allowedOrigins("*")
- .exposedHeaders("Content-Disposition")
- .allowedMethods("GET", "POST", "PUT", "DELETE", "HEAD");
-
- }
-
- @Bean
- public InternalResourceViewResolver defaultViewResolver() {
- return new InternalResourceViewResolver();
- }
-
- @Override
- public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
- configurer.defaultContentType(MediaType.APPLICATION_JSON);
- }
-
- }
|