package devopsdistilled.operp.server;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import devopsdistilled.operp.server.context.AppContext;
import devopsdistilled.operp.server.data.entity.Item;
import devopsdistilled.operp.server.data.repo.ItemRepository;

public class ServerApp {
/*
	@Inject
	ItemRepository itemRepository;
*/
	public static void main(String[] args) {
		ApplicationContext context = new AnnotationConfigApplicationContext(
				AppContext.class);
		ItemRepository itemRepository = context.getBean(ItemRepository.class);
		
		Item item = new Item();
		item.setName("Test Item");
		item = itemRepository.save(item );
		System.out.println(itemRepository.findOne(item.getId()));
		System.out.println(context);
	}

	
}

@@ -274,20 +274,23 @@
 .entity.
-Item
+Product
 ;%0Aimport
@@ -329,20 +329,23 @@
 ta.repo.
-Item
+Product
 Reposito
@@ -378,21 +378,24 @@
 p %7B%0A
+%09
 /*%0A%09
+ * 
 @Inject
-%0A%09
+ 
 Item
@@ -421,16 +421,18 @@
 sitory;%0A
+%09 
 */%0A%09publ
@@ -564,20 +564,23 @@
 ass);%0A%09%09
-Item
+Product
 Reposito
@@ -574,36 +574,39 @@
 oductRepository 
-item
+product
 Repository = con
@@ -609,16 +609,21 @@
  context
+%0A%09%09%09%09
 .getBean
@@ -623,20 +623,23 @@
 getBean(
-Item
+Product
 Reposito
@@ -655,77 +655,102 @@
 ;%0A%09%09
-%0A%09%09Item item = new Item();%0A%09%09item.setName(%22Test Item%22);%0A%09%09item = item
+Product product = new Product();%0A%09%09product.setProductName(%22Product Test%22);%0A%09%09product = product
 Repo
@@ -765,13 +765,15 @@
 ave(
-item 
+product
 );%0A%09
@@ -792,20 +792,23 @@
 println(
-item
+product
 Reposito
@@ -822,15 +822,25 @@
 One(
-item.ge
+product.getProduc
 tId(
@@ -881,10 +881,7 @@
 ;%0A%09%7D
-%0A%0A%09
 %0A%7D%0A

Refactor ItemRepository with ProductRepository