BAEL-97 - moving config to test source tree

This commit is contained in:
slavisa-baeldung 2017-01-09 16:47:27 +01:00
parent 516fa14625
commit 66917a2877
10 changed files with 9 additions and 107 deletions

View File

@ -1,43 +0,0 @@
package com.baeldung.spring.web.config;
import com.baeldung.web.controller.handlermapping.BeanNameHandlerMappingController;
import com.baeldung.web.controller.handlermapping.SimpleUrlMappingController;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping;
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
import java.util.HashMap;
import java.util.Map;
@Configuration
public class HandlerMappingCustomPrioritiesConfig {
@Bean
BeanNameUrlHandlerMapping beanNameUrlHandlerMapping() {
BeanNameUrlHandlerMapping beanNameUrlHandlerMapping = new BeanNameUrlHandlerMapping();
beanNameUrlHandlerMapping.setOrder(0);
return beanNameUrlHandlerMapping;
}
@Bean
public SimpleUrlHandlerMapping simpleUrlHandlerMapping() {
SimpleUrlHandlerMapping simpleUrlHandlerMapping = new SimpleUrlHandlerMapping();
Map<String, Object> urlMap = new HashMap<>();
urlMap.put("/welcome", simpleUrlMapping());
simpleUrlHandlerMapping.setUrlMap(urlMap);
simpleUrlHandlerMapping.setOrder(1);
return simpleUrlHandlerMapping;
}
@Bean
public SimpleUrlMappingController simpleUrlMapping() {
return new SimpleUrlMappingController();
}
@Bean("/welcome")
public BeanNameHandlerMappingController beanNameHandlerMapping() {
return new BeanNameHandlerMappingController();
}
}

View File

@ -1,54 +0,0 @@
package com.baeldung.spring.web.config;
import com.baeldung.web.controller.handlermapping.SimpleUrlMappingController;
import com.baeldung.web.controller.handlermapping.BeanNameHandlerMappingController;
import com.baeldung.web.controller.handlermapping.WelcomeController;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping;
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
import org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping;
import java.util.HashMap;
import java.util.Map;
@Configuration
public class HandlerMappingPrioritiesConfigNoOrder {
@Bean
public SimpleUrlHandlerMapping simpleUrlHandlerMapping() {
SimpleUrlHandlerMapping simpleUrlHandlerMapping = new SimpleUrlHandlerMapping();
Map<String, Object> urlMap = new HashMap<>();
urlMap.put("/welcome", test());
simpleUrlHandlerMapping.setUrlMap(urlMap);
return simpleUrlHandlerMapping;
}
@Bean
public ControllerClassNameHandlerMapping controllerClassNameHandlerMapping() {
ControllerClassNameHandlerMapping bean = new ControllerClassNameHandlerMapping();
return bean;
}
@Bean
BeanNameUrlHandlerMapping beanNameUrlHandlerMapping() {
BeanNameUrlHandlerMapping beanNameUrlHandlerMapping = new BeanNameUrlHandlerMapping();
return beanNameUrlHandlerMapping;
}
@Bean("/welcome")
public SimpleUrlMappingController welcomeBaeldungController() {
return new SimpleUrlMappingController();
}
@Bean
public BeanNameHandlerMappingController test() {
return new BeanNameHandlerMappingController();
}
@Bean
public WelcomeController welcomeController() {
return new WelcomeController();
}
}

View File

@ -1,4 +1,4 @@
package com.baeldung.spring.web.config;
package com.baeldung.config;
import com.baeldung.web.controller.handlermapping.WelcomeController;
import org.springframework.context.annotation.Bean;

View File

@ -1,14 +1,14 @@
package com.baeldung.spring.web.config;
package com.baeldung.config;
import com.baeldung.web.controller.handlermapping.WelcomeController;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
@EnableWebMvc
@Configuration
public class ControllerClassNameHandlerMappingConfig {

View File

@ -1,4 +1,4 @@
package com.baeldung.spring.web.config;
package com.baeldung.config;
import java.util.HashMap;
import java.util.Map;

View File

@ -1,4 +1,4 @@
package com.baeldung.spring.web.config;
package com.baeldung.config;
import java.util.HashMap;
import java.util.Map;

View File

@ -1,6 +1,6 @@
package com.baeldung.handlermappings;
import com.baeldung.spring.web.config.BeanNameUrlHandlerMappingConfig;
import com.baeldung.config.BeanNameUrlHandlerMappingConfig;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@ -17,7 +17,7 @@ import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
import com.baeldung.spring.web.config.ControllerClassNameHandlerMappingConfig;
import com.baeldung.config.ControllerClassNameHandlerMappingConfig;
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration

View File

@ -1,7 +1,6 @@
package com.baeldung.handlermappings;
import com.baeldung.spring.web.config.HandlerMappingCustomPrioritiesConfig;
import com.baeldung.spring.web.config.HandlerMappingPrioritiesConfig;
import com.baeldung.config.HandlerMappingPrioritiesConfig;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@ -1,6 +1,6 @@
package com.baeldung.handlermappings;
import com.baeldung.spring.web.config.SimpleUrlHandlerMappingConfig;
import com.baeldung.config.SimpleUrlHandlerMappingConfig;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;