Last active
November 16, 2021 14:44
-
-
Save jeffscottbrown/ffd90179fbde55b7311323c63f727fd5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
requestscope (master)$ cat src/main/java/requestscope/Helper.java | |
package requestscope; | |
import io.micronaut.runtime.http.scope.RequestScope; | |
@RequestScope | |
public class Helper { | |
public int getTheAnswer() { return 42; } | |
} | |
requestscope (master)$ | |
requestscope (master)$ cat src/main/java/requestscope/DemoController.java | |
package requestscope; | |
import io.micronaut.http.annotation.Controller; | |
import io.micronaut.http.annotation.Get; | |
import jakarta.inject.Inject; | |
@Controller("/demo") | |
public class DemoController { | |
@Inject | |
Helper helper; | |
@Get(uri = "/", produces = "text/plain") | |
public String index() { | |
return "The Answer Is " + helper.getTheAnswer(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment