Skip to content

Instantly share code, notes, and snippets.

@asmoker
Last active August 29, 2015 14:23
Show Gist options
  • Select an option

  • Save asmoker/79e738f55f617ed58daf to your computer and use it in GitHub Desktop.

Select an option

Save asmoker/79e738f55f617ed58daf to your computer and use it in GitHub Desktop.
spring framework demo
@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