diff options
author | Vitaly Takmazov | 2016-11-25 10:04:29 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-11-25 10:04:29 +0300 |
commit | 68b230f42f93a2e801292a2085cc3fce3a676823 (patch) | |
tree | d2da2ed337641689829c1e483305046de01080b3 /juick-api/src/main/java/com/juick/api/configuration | |
parent | 6b018f65a4f0391bb7f8e2a06616b8541d0a452e (diff) |
juick-api: JSONP and CORS
Diffstat (limited to 'juick-api/src/main/java/com/juick/api/configuration')
-rw-r--r-- | juick-api/src/main/java/com/juick/api/configuration/ApiMvcConfiguration.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/juick-api/src/main/java/com/juick/api/configuration/ApiMvcConfiguration.java b/juick-api/src/main/java/com/juick/api/configuration/ApiMvcConfiguration.java index 7183ab1f..8e0087d7 100644 --- a/juick-api/src/main/java/com/juick/api/configuration/ApiMvcConfiguration.java +++ b/juick-api/src/main/java/com/juick/api/configuration/ApiMvcConfiguration.java @@ -2,13 +2,12 @@ package com.juick.api.configuration; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; -import com.juick.api.ApiServer; -import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; @@ -18,7 +17,7 @@ import java.util.List; * Created by vitalyster on 28.06.2016. */ @Configuration -@ComponentScan(basePackages = {"com.juick.api"}) +@ComponentScan(basePackages = {"com.juick.api.controllers"}) public class ApiMvcConfiguration extends WebMvcConfigurationSupport { @Override @@ -40,4 +39,9 @@ public class ApiMvcConfiguration extends WebMvcConfigurationSupport { converters.add(converter); super.configureMessageConverters(converters); } + + @Override + protected void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**"); + } } |