File tree Expand file tree Collapse file tree 4 files changed +9
-12
lines changed
main/java/com/naturalprogrammer/spring/tutorial/controllers
test/java/com/naturalprogrammer/spring/tutorial Expand file tree Collapse file tree 4 files changed +9
-12
lines changed Original file line number Diff line number Diff line change 1414 <parent >
1515 <groupId >org.springframework.boot</groupId >
1616 <artifactId >spring-boot-starter-parent</artifactId >
17- <version >1.3.2 .RELEASE</version >
17+ <version >1.4.0 .RELEASE</version >
1818 <relativePath /> <!-- lookup parent from repository -->
1919 </parent >
2020
Original file line number Diff line number Diff line change 22
33import javax .mail .MessagingException ;
44
5- import org .springframework .beans .factory .annotation .Autowired ;
65import org .springframework .web .bind .annotation .RequestMapping ;
76import org .springframework .web .bind .annotation .RestController ;
87
@@ -13,7 +12,6 @@ public class MailController {
1312
1413 private MailSender mailSender ;
1514
16- @ Autowired
1715 public MailController (MailSender mailSender ) {
1816 this .mailSender = mailSender ;
1917 }
Original file line number Diff line number Diff line change 66import org .springframework .ui .Model ;
77import org .springframework .validation .BindingResult ;
88import org .springframework .validation .annotation .Validated ;
9+ import org .springframework .web .bind .annotation .GetMapping ;
10+ import org .springframework .web .bind .annotation .PostMapping ;
911import org .springframework .web .bind .annotation .RequestMapping ;
10- import org .springframework .web .bind .annotation .RequestMethod ;
1112
1213import com .naturalprogrammer .spring .tutorial .domain .User ;
1314
@@ -17,14 +18,14 @@ public class SignupController {
1718
1819 private static final Log log = LogFactory .getLog (SignupController .class );
1920
20- @ RequestMapping ( method = RequestMethod . GET )
21+ @ GetMapping
2122 public String signup (Model model ) {
2223
2324 model .addAttribute (new User ());
2425 return "signup" ;
2526 }
2627
27- @ RequestMapping ( method = RequestMethod . POST )
28+ @ PostMapping
2829 public String doSignup (@ Validated User user , BindingResult result ) {
2930
3031 if (result .hasErrors ())
Original file line number Diff line number Diff line change 22
33import org .junit .Test ;
44import org .junit .runner .RunWith ;
5- import org .springframework .boot .test .SpringApplicationConfiguration ;
6- import org .springframework .test .context .junit4 .SpringJUnit4ClassRunner ;
7- import org .springframework .test .context .web .WebAppConfiguration ;
5+ import org .springframework .boot .test .context .SpringBootTest ;
6+ import org .springframework .test .context .junit4 .SpringRunner ;
87
9- @ RunWith (SpringJUnit4ClassRunner .class )
10- @ SpringApplicationConfiguration (classes = NpSpringTutorialApplication .class )
11- @ WebAppConfiguration
8+ @ RunWith (SpringRunner .class )
9+ @ SpringBootTest
1210public class NpSpringTutorialApplicationTests {
1311
1412 @ Test
You can’t perform that action at this time.
0 commit comments