changing controller mapping

This commit is contained in:
eugenp 2017-06-17 14:04:38 +03:00
parent b11496ce26
commit 5a5f3fa459
6 changed files with 11 additions and 12 deletions

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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<Long, Foo> myfoos;

View File

@ -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() {

View File

@ -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";

View File

@ -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
}