Last active
August 29, 2015 14:23
-
-
Save asmoker/79e738f55f617ed58daf to your computer and use it in GitHub Desktop.
spring framework demo
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
| @Configuration | |
| @ComponentScan | |
| public class Application { | |
| @Bean | |
| MessageService mockMessageService() { | |
| return new MessageService() { | |
| public String getMessage() { | |
| return "Hello Spring"; | |
| } | |
| }; | |
| } | |
| public static void main(String[] args) { | |
| ApplicationContext context = new AnnotationConfigApplicationContext(Application.class); | |
| MessagePrinter printer = context.getBean(MessagePrinter.class); | |
| printer.printMessage(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment