This commit is contained in:
Phillip Webb
2014-01-10 12:55:25 -08:00
parent 26d900f3ad
commit 47da8a817a
26 changed files with 112 additions and 66 deletions

View File

@@ -41,7 +41,8 @@ public class SampleSecureApplication implements CommandLineRunner {
.commaSeparatedStringToAuthorityList("ROLE_USER")));
try {
System.out.println(service.secure());
} finally {
}
finally {
SecurityContextHolder.clearContext();
}
}

View File

@@ -22,11 +22,11 @@ import org.springframework.stereotype.Service;
/**
* @author Dave Syer
*
*
*/
@Service
public class SampleService {
@Secured("ROLE_USER")
public String secure() {
return "Hello Security";

View File

@@ -51,7 +51,7 @@ public class SampleServletApplication extends SpringBootServletInitializer {
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleServletApplication.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(SampleServletApplication.class);

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/base.xml"/>
<include resource="org/springframework/boot/logging/logback/base.xml"/>
<!-- logger name="org.springframework" level="DEBUG"/-->
</configuration>