You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

30 lines
906 B

  1. package com.ffii.tsms.config;
  2. import org.springframework.context.annotation.Bean;
  3. import org.springframework.context.annotation.Configuration;
  4. import org.springframework.web.servlet.config.annotation.CorsRegistry;
  5. import org.springframework.web.servlet.config.annotation.EnableWebMvc;
  6. import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
  7. import org.springframework.web.servlet.view.InternalResourceViewResolver;
  8. @Configuration
  9. @EnableWebMvc
  10. public class WebConfig implements WebMvcConfigurer {
  11. @Override
  12. public void addCorsMappings(CorsRegistry registry) {
  13. registry.addMapping("/**")
  14. .allowedHeaders("*")
  15. .allowedOrigins("*")
  16. .exposedHeaders("filename")
  17. .allowedMethods("GET", "POST", "PUT", "DELETE", "HEAD");
  18. }
  19. @Bean
  20. public InternalResourceViewResolver defaultViewResolver() {
  21. return new InternalResourceViewResolver();
  22. }
  23. }