From 5a5f3fa4591ccf2fb215e69415f26f4423d6e630 Mon Sep 17 00:00:00 2001 From: eugenp Date: Sat, 17 Jun 2017 14:04:38 +0300 Subject: [PATCH] changing controller mapping --- .../{Application.java => ImageApplication.java} | 5 ++--- .../config/{Application.java => MainApplication.java} | 4 ++-- .../java/org/baeldung/web/controller/MyFooController.java | 2 +- .../org/baeldung/client/RestTemplateBasicLiveTest.java | 2 +- .../baeldung/client/TestRestTemplateBasicLiveTest.java | 2 +- .../src/main/java/org/baeldung/config/SecurityConfig.java | 8 ++++---- 6 files changed, 11 insertions(+), 12 deletions(-) rename spring-rest/src/main/java/com/baeldung/produceimage/{Application.java => ImageApplication.java} (70%) rename spring-rest/src/main/java/org/baeldung/config/{Application.java => MainApplication.java} (77%) diff --git a/spring-rest/src/main/java/com/baeldung/produceimage/Application.java b/spring-rest/src/main/java/com/baeldung/produceimage/ImageApplication.java similarity index 70% rename from spring-rest/src/main/java/com/baeldung/produceimage/Application.java rename to spring-rest/src/main/java/com/baeldung/produceimage/ImageApplication.java index 179671d094..82a6203fe5 100644 --- a/spring-rest/src/main/java/com/baeldung/produceimage/Application.java +++ b/spring-rest/src/main/java/com/baeldung/produceimage/ImageApplication.java @@ -3,12 +3,11 @@ package com.baeldung.produceimage; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.PropertySource; @EnableAutoConfiguration @ComponentScan("com.baeldung.produceimage") -public class Application { +public class ImageApplication { public static void main(final String[] args) { - SpringApplication.run(Application.class, args); + SpringApplication.run(ImageApplication.class, args); } } diff --git a/spring-rest/src/main/java/org/baeldung/config/Application.java b/spring-rest/src/main/java/org/baeldung/config/MainApplication.java similarity index 77% rename from spring-rest/src/main/java/org/baeldung/config/Application.java rename to spring-rest/src/main/java/org/baeldung/config/MainApplication.java index 077213b04d..e31fdfaaa9 100644 --- a/spring-rest/src/main/java/org/baeldung/config/Application.java +++ b/spring-rest/src/main/java/org/baeldung/config/MainApplication.java @@ -7,10 +7,10 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter @EnableAutoConfiguration @ComponentScan("org.baeldung") -public class Application extends WebMvcConfigurerAdapter { +public class MainApplication extends WebMvcConfigurerAdapter { public static void main(final String[] args) { - SpringApplication.run(Application.class, args); + SpringApplication.run(MainApplication.class, args); } } \ No newline at end of file diff --git a/spring-rest/src/main/java/org/baeldung/web/controller/MyFooController.java b/spring-rest/src/main/java/org/baeldung/web/controller/MyFooController.java index f19ddca435..ff95e791d0 100644 --- a/spring-rest/src/main/java/org/baeldung/web/controller/MyFooController.java +++ b/spring-rest/src/main/java/org/baeldung/web/controller/MyFooController.java @@ -19,7 +19,7 @@ import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.servlet.support.ServletUriComponentsBuilder; @Controller -@RequestMapping(value = "/myfoos") +@RequestMapping(value = "/foos") public class MyFooController { private final Map myfoos; diff --git a/spring-rest/src/test/java/org/baeldung/client/RestTemplateBasicLiveTest.java b/spring-rest/src/test/java/org/baeldung/client/RestTemplateBasicLiveTest.java index c9dad8ccf0..b7d862c7cc 100644 --- a/spring-rest/src/test/java/org/baeldung/client/RestTemplateBasicLiveTest.java +++ b/spring-rest/src/test/java/org/baeldung/client/RestTemplateBasicLiveTest.java @@ -36,7 +36,7 @@ import com.google.common.base.Charsets; public class RestTemplateBasicLiveTest { private RestTemplate restTemplate; - private static final String fooResourceUrl = "http://localhost:" + APPLICATION_PORT + "/spring-rest/myfoos"; + private static final String fooResourceUrl = "http://localhost:" + APPLICATION_PORT + "/spring-rest/foos"; @Before public void beforeTest() { diff --git a/spring-rest/src/test/java/org/baeldung/client/TestRestTemplateBasicLiveTest.java b/spring-rest/src/test/java/org/baeldung/client/TestRestTemplateBasicLiveTest.java index a4d8eb0908..a26801429e 100644 --- a/spring-rest/src/test/java/org/baeldung/client/TestRestTemplateBasicLiveTest.java +++ b/spring-rest/src/test/java/org/baeldung/client/TestRestTemplateBasicLiveTest.java @@ -20,7 +20,7 @@ import static org.junit.Assert.assertTrue; public class TestRestTemplateBasicLiveTest { private RestTemplate restTemplate; - private static final String FOO_RESOURCE_URL = "http://localhost:" + APPLICATION_PORT + "/spring-rest/myfoos"; + private static final String FOO_RESOURCE_URL = "http://localhost:" + APPLICATION_PORT + "/spring-rest/foos"; private static final String URL_SECURED_BY_AUTHENTICATION = "http://httpbin.org/basic-auth/user/passwd"; private static final String BASE_URL = "http://localhost:" + APPLICATION_PORT + "/spring-rest"; diff --git a/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/SecurityConfig.java b/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/SecurityConfig.java index 9de203b7c3..a568c22eec 100644 --- a/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/SecurityConfig.java +++ b/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/SecurityConfig.java @@ -14,7 +14,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { private AuthenticationManager authenticationManager; @Override - protected void configure(HttpSecurity http) throws Exception { + protected void configure(HttpSecurity http) throws Exception { // @formatter:off http.requestMatchers() .antMatchers("/login", "/oauth/authorize") .and() @@ -24,15 +24,15 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { .and() .formLogin() .permitAll(); - } + } // @formatter:on @Override - protected void configure(AuthenticationManagerBuilder auth) throws Exception { + protected void configure(AuthenticationManagerBuilder auth) throws Exception { // @formatter:off auth.parentAuthenticationManager(authenticationManager) .inMemoryAuthentication() .withUser("john") .password("123") .roles("USER"); - } + } // @formatter:on }