diff --git a/wise-webapp/src/main/java/com/wisemapping/config/Application.java b/wise-webapp/src/main/java/com/wisemapping/config/Application.java index 82d44a66..0c5a8502 100644 --- a/wise-webapp/src/main/java/com/wisemapping/config/Application.java +++ b/wise-webapp/src/main/java/com/wisemapping/config/Application.java @@ -18,11 +18,10 @@ import org.springframework.security.web.firewall.StrictHttpFirewall; public class Application { public static void main(String[] args) { - new SpringApplicationBuilder() .parent(HibernateConfig.class, ServletConfig.class, CommonConfig.class, SecurityConfig.class).web(WebApplicationType.NONE) -// .child(MvcAppConfig.class, MvcSecurityConfig.class, SecurityConfig.class, InterceptorsConfig.class).web(WebApplicationType.SERVLET) - .child(RestAppConfig.class, ServletConfig.class, InterceptorsConfig.class).web(WebApplicationType.SERVLET) + .child(MvcAppConfig.class, MvcSecurityConfig.class, SecurityConfig.class, InterceptorsConfig.class).web(WebApplicationType.SERVLET) + .sibling(RestAppConfig.class, ServletConfig.class, InterceptorsConfig.class).web(WebApplicationType.SERVLET) .run(args); } diff --git a/wise-webapp/src/main/java/com/wisemapping/config/common/InterceptorsConfig.java b/wise-webapp/src/main/java/com/wisemapping/config/common/InterceptorsConfig.java index 7ef01609..3d79186f 100644 --- a/wise-webapp/src/main/java/com/wisemapping/config/common/InterceptorsConfig.java +++ b/wise-webapp/src/main/java/com/wisemapping/config/common/InterceptorsConfig.java @@ -22,11 +22,12 @@ import com.wisemapping.filter.UserLocaleInterceptor; import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; import org.springframework.stereotype.Component; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -@Component +@Configuration @ComponentScan("com.wisemapping.filter") public class InterceptorsConfig implements WebMvcConfigurer { @Autowired diff --git a/wise-webapp/src/main/java/com/wisemapping/config/mvc/MvcAppConfig.java b/wise-webapp/src/main/java/com/wisemapping/config/mvc/MvcAppConfig.java index 6d3795c0..6cb0ae40 100644 --- a/wise-webapp/src/main/java/com/wisemapping/config/mvc/MvcAppConfig.java +++ b/wise-webapp/src/main/java/com/wisemapping/config/mvc/MvcAppConfig.java @@ -1,9 +1,10 @@ package com.wisemapping.config.mvc; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.ImportResource; +import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.HandlerExceptionResolver; import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.config.annotation.EnableWebMvc; @@ -14,7 +15,8 @@ import org.springframework.web.servlet.view.InternalResourceViewResolver; import org.springframework.web.servlet.view.JstlView; -@SpringBootApplication +@Configuration +@EnableAutoConfiguration @EnableWebMvc @ComponentScan("com.wisemapping.webmvc") public class MvcAppConfig implements WebMvcConfigurer { diff --git a/wise-webapp/src/main/java/com/wisemapping/config/mvc/MvcSecurityConfig.java b/wise-webapp/src/main/java/com/wisemapping/config/mvc/MvcSecurityConfig.java index a9855948..cb236793 100644 --- a/wise-webapp/src/main/java/com/wisemapping/config/mvc/MvcSecurityConfig.java +++ b/wise-webapp/src/main/java/com/wisemapping/config/mvc/MvcSecurityConfig.java @@ -14,7 +14,6 @@ import org.springframework.web.servlet.handler.HandlerMappingIntrospector; @Configuration @EnableWebSecurity public class MvcSecurityConfig { - @Bean @Order(1) public SecurityFilterChain embeddedDisabledXOrigin(@NotNull final HttpSecurity http, @NotNull final MvcRequestMatcher.Builder mvc) throws Exception { diff --git a/wise-webapp/src/main/java/com/wisemapping/config/rest/RestAppConfig.java b/wise-webapp/src/main/java/com/wisemapping/config/rest/RestAppConfig.java index d9dc4231..f1df387b 100644 --- a/wise-webapp/src/main/java/com/wisemapping/config/rest/RestAppConfig.java +++ b/wise-webapp/src/main/java/com/wisemapping/config/rest/RestAppConfig.java @@ -1,11 +1,11 @@ package com.wisemapping.config.rest; import org.jetbrains.annotations.NotNull; -import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.web.SecurityFilterChain; @@ -15,8 +15,8 @@ import org.springframework.web.servlet.handler.HandlerMappingIntrospector; import static org.springframework.security.config.Customizer.withDefaults; -@SpringBootApplication -@EnableWebSecurity +@Configuration +@EnableAutoConfiguration @ComponentScan({"com.wisemapping.rest"}) public class RestAppConfig { @Bean diff --git a/wise-webapp/src/test/java/com/wisemapping/test/rest/RestAccountITCase.java b/wise-webapp/src/test/java/com/wisemapping/test/rest/RestAccountControllerTest.java similarity index 91% rename from wise-webapp/src/test/java/com/wisemapping/test/rest/RestAccountITCase.java rename to wise-webapp/src/test/java/com/wisemapping/test/rest/RestAccountControllerTest.java index 103caa9f..7473c8de 100644 --- a/wise-webapp/src/test/java/com/wisemapping/test/rest/RestAccountITCase.java +++ b/wise-webapp/src/test/java/com/wisemapping/test/rest/RestAccountControllerTest.java @@ -19,24 +19,27 @@ package com.wisemapping.test.rest; +import com.wisemapping.config.Application; import com.wisemapping.rest.model.RestUser; import org.jetbrains.annotations.NotNull; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.*; import org.springframework.web.client.RestTemplate; -import org.testng.annotations.Test; import java.net.URI; +import java.util.Collection; import static com.wisemapping.test.rest.RestHelper.*; -import static org.testng.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; -@Test + +@SpringBootTest(classes = Application.class) public class RestAccountITCase { - @Test(dataProviderClass = RestHelper.class, dataProvider="ContentType-Provider-Function") - public void deleteUser(final @NotNull MediaType mediaType) { // Configure media types ... - final HttpHeaders requestHeaders = createHeaders(mediaType); + public void deleteUser() { // Configure media types ... + final HttpHeaders requestHeaders = createHeaders(MediaType.APPLICATION_JSON); final RestTemplate adminTemplate = createTemplate(ADMIN_CREDENTIALS); final RestUser dummyUser = createDummyUser();