Make it easier to add auto-configuration to a test slice

Previously, an entry had to be added to spring.factories using the
name of one of the @AutoConfigure… meta-annotations on the @…Test
annotation as the key. This indirection was unnecessarily complicated.

This commit simplifies things by allowing the name of the @…Test
annotation itself to be used as the key.

Closes gh-6335
This commit is contained in:
Andy Wilkinson
2016-07-06 16:41:06 +01:00
parent 4fe28727ad
commit 3286760073
6 changed files with 26 additions and 3 deletions

View File

@@ -18,6 +18,7 @@ package sample.devtools;
import java.util.Date;
import javax.annotation.PostConstruct;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
@@ -28,6 +29,11 @@ import org.springframework.web.servlet.ModelAndView;
@Controller
public class MyController {
@PostConstruct
public void slowRestart() throws InterruptedException {
Thread.sleep(5000);
}
@GetMapping("/")
public ModelAndView get(HttpSession session) {
Object sessionVar = session.getAttribute("var");