Skip to content
This repository was archived by the owner on Dec 12, 2018. It is now read-only.

Commit 33b9175

Browse files
committed
Updated 00 the basics tutorial to use Autowired rather than INSTANCE.
1 parent 476f5a4 commit 33b9175

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.stormpath.tutorial.controller;
22

33
import com.stormpath.sdk.application.Application;
4-
import com.stormpath.sdk.servlet.application.ApplicationResolver;
4+
import org.springframework.beans.factory.annotation.Autowired;
55
import org.springframework.web.bind.annotation.RequestMapping;
66
import org.springframework.web.bind.annotation.RestController;
77

@@ -10,9 +10,11 @@
1010
@RestController
1111
public class HelloController {
1212

13+
@Autowired
14+
Application app;
15+
1316
@RequestMapping("/")
1417
public String hello(HttpServletRequest req) {
15-
Application app = ApplicationResolver.INSTANCE.getApplication(req);
1618
return "Hello, " + app.getName();
1719
}
1820
}

tutorials/spring/00-the-basics/src/main/java/com/stormpath/tutorial/controller/HelloController.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
package com.stormpath.tutorial.controller;
1717

1818
import com.stormpath.sdk.application.Application;
19-
import com.stormpath.sdk.servlet.application.ApplicationResolver;
19+
import org.springframework.beans.factory.annotation.Autowired;
2020
import org.springframework.web.bind.annotation.RequestMapping;
2121
import org.springframework.web.bind.annotation.RestController;
2222

@@ -28,9 +28,11 @@
2828
@RestController
2929
public class HelloController {
3030

31+
@Autowired
32+
Application app;
33+
3134
@RequestMapping("/")
32-
public String hello(HttpServletRequest req) {
33-
Application app = ApplicationResolver.INSTANCE.getApplication(req);
35+
public String hello() {
3436
return "Hello, " + app.getName();
3537
}
3638
}

0 commit comments

Comments
 (0)