-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
97b38c8
commit 5aa8911
Showing
2 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
10 changes: 9 additions & 1 deletion
10
src/main/java/guru/springframework/sfgdi/SfgDiApplication.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
package guru.springframework.sfgdi; | ||
|
||
import guru.springframework.sfgdi.controllers.MyController; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.context.ApplicationContext; | ||
|
||
@SpringBootApplication | ||
public class SfgDiApplication { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(SfgDiApplication.class, args); | ||
ApplicationContext ctx = SpringApplication.run(SfgDiApplication.class, args); | ||
|
||
MyController myController = (MyController) ctx.getBean("myController"); | ||
|
||
String greeting = myController.sayHello(); | ||
|
||
System.out.println(greeting); | ||
} | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/guru/springframework/sfgdi/controllers/MyController.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package guru.springframework.sfgdi.controllers; | ||
|
||
import org.springframework.stereotype.Controller; | ||
|
||
/** | ||
* Created by jt on 12/26/19. | ||
*/ | ||
@Controller | ||
public class MyController { | ||
|
||
public String sayHello(){ | ||
System.out.println("Hello World!!!"); | ||
|
||
return "Hi Folks!"; | ||
} | ||
} |