security work

This commit is contained in:
eparaschiv 2013-06-02 19:59:08 +03:00
parent 124f0492ed
commit d28c7a14f8
12 changed files with 71 additions and 9 deletions

View File

@ -1,4 +1,4 @@
package org.baeldung.spring.config;
package org.baeldung.spring;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

View File

@ -1,4 +1,4 @@
package org.baeldung.spring.config;
package org.baeldung.spring;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

View File

@ -1,4 +1,4 @@
package org.baeldung.spring.config;
package org.baeldung.spring;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

View File

@ -1,4 +1,4 @@
package org.baeldung.spring.config;
package org.baeldung.spring;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

View File

@ -17,7 +17,7 @@
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>org.baeldung.spring.config</param-value>
<param-value>org.baeldung.spring</param-value>
</context-param>
<listener>

View File

@ -0,0 +1,17 @@
package org.baeldung.spring;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
@ComponentScan("org.baeldung.web")
public class WebConfig extends WebMvcConfigurerAdapter {
public WebConfig() {
super();
}
// API
}

View File

@ -0,0 +1,34 @@
package org.baeldung.web.controller;
import javax.servlet.http.HttpServletResponse;
import org.baeldung.web.dto.Foo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.util.UriComponentsBuilder;
@Controller
@RequestMapping(value = "/foo")
public class FooController {
@Autowired
private ApplicationEventPublisher eventPublisher;
public FooController() {
super();
}
// API
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public Foo findOne(@PathVariable("id") final Long id, final UriComponentsBuilder uriBuilder, final HttpServletResponse response) {
return new Foo();
}
}

View File

@ -0,0 +1,11 @@
package org.baeldung.web.dto;
import java.io.Serializable;
public class Foo implements Serializable {
public Foo() {
super();
}
}

View File

@ -1,4 +1,4 @@
package org.baeldung.spring.config;
package org.baeldung.spring;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

View File

@ -1,4 +1,4 @@
package org.baeldung.spring.config;
package org.baeldung.spring;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

View File

@ -1,4 +1,4 @@
package org.baeldung.spring.config;
package org.baeldung.spring;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

View File

@ -15,7 +15,7 @@
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>org.baeldung.spring.config</param-value>
<param-value>org.baeldung.spring</param-value>
</context-param>
<listener>