BAEL-97 - moving config to test source tree
This commit is contained in:
parent
516fa14625
commit
66917a2877
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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;
|
|
@ -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 {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.spring.web.config;
|
||||
package com.baeldung.config;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.spring.web.config;
|
||||
package com.baeldung.config;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue