diff --git a/MyGitSpringProject/pom.xml b/MyGitSpringProject/pom.xml index 94b5123..3fb0cab 100644 --- a/MyGitSpringProject/pom.xml +++ b/MyGitSpringProject/pom.xml @@ -24,7 +24,7 @@ commons-logging commons-logging - + @@ -32,14 +32,14 @@ spring-webmvc ${org.springframework-version} - + org.aspectj aspectjrt ${org.aspectj-version} - - + + org.slf4j @@ -89,7 +89,7 @@ javax.inject 1 - + javax.servlet @@ -108,51 +108,58 @@ jstl 1.2 - + junit junit 4.7 test - + + + + + org.codehaus.jackson + jackson-mapper-asl + 1.9.9 + - - - - maven-eclipse-plugin - 2.9 - - - org.springframework.ide.eclipse.core.springnature - - - org.springframework.ide.eclipse.core.springbuilder - - true - true - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.5.1 - - 1.6 - 1.6 - -Xlint:all - true - true - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - org.test.int1.Main - - - - + + + + maven-eclipse-plugin + 2.9 + + + org.springframework.ide.eclipse.core.springnature + + + org.springframework.ide.eclipse.core.springbuilder + + true + true + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.5.1 + + 1.6 + 1.6 + -Xlint:all + true + true + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + org.test.int1.Main + + + + diff --git a/MyGitSpringProject/src/main/java/com/ruby/codej/AjaxCallController.java b/MyGitSpringProject/src/main/java/com/ruby/codej/AjaxCallController.java new file mode 100644 index 0000000..a4648d9 --- /dev/null +++ b/MyGitSpringProject/src/main/java/com/ruby/codej/AjaxCallController.java @@ -0,0 +1,38 @@ +package com.ruby.codej; + +import java.text.DateFormat; +import java.time.DayOfWeek; +import java.util.Date; +import java.util.Locale; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +/** + * @author woohyunjo + */ +@Controller +@RequestMapping("/ajax") +public class AjaxCallController { + private static final Logger LOGGER = LoggerFactory.getLogger(HomeController.class); + + @RequestMapping(value = "/list", method = RequestMethod.GET) + public String home(Locale locale, Model model) { + LOGGER.info("Welcome home! The client locale is {}.", locale); + + Date date = new Date(); + DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale); + + String formattedDate = dateFormat.format(date); + + model.addAttribute("serverTime", formattedDate); + + LOGGER.info("ajax list call"); + + return "home"; + } +} diff --git a/MyGitSpringProject/src/main/java/com/ruby/codej/AutoCompleteWord.java b/MyGitSpringProject/src/main/java/com/ruby/codej/AutoCompleteWord.java new file mode 100644 index 0000000..2e852f6 --- /dev/null +++ b/MyGitSpringProject/src/main/java/com/ruby/codej/AutoCompleteWord.java @@ -0,0 +1,108 @@ +package com.ruby.codej; + + +/** + * Created by jekalmin on 2015-10-14. + */ +public class AutoCompleteWord { + + String type; + String word; + String html; + String count; + String initMatch; + String parentCatSrl; + String parentCatName; + String gnbCatSrl; + String gnbCatName; + String viewGnbCat; + String isMartCat; + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getWord() { + return word; + } + + public void setWord(String word) { + this.word = word; + } + + public String getHtml() { + return html; + } + + public void setHtml(String html) { + this.html = html; + } + + public String getCount() { + return count; + } + + public void setCount(String count) { + this.count = count; + } + + public String getInitMatch() { + return initMatch; + } + + public void setInitMatch(String initMatch) { + this.initMatch = initMatch; + } + + public String getParentCatSrl() { + return parentCatSrl; + } + + public void setParentCatSrl(String parentCatSrl) { + this.parentCatSrl = parentCatSrl; + } + + public String getParentCatName() { + return parentCatName; + } + + public void setParentCatName(String parentCatName) { + this.parentCatName = parentCatName; + } + + public String getGnbCatSrl() { + return gnbCatSrl; + } + + public void setGnbCatSrl(String gnbCatSrl) { + this.gnbCatSrl = gnbCatSrl; + } + + public String getGnbCatName() { + return gnbCatName; + } + + public void setGnbCatName(String gnbCatName) { + this.gnbCatName = gnbCatName; + } + + public String getViewGnbCat() { + return viewGnbCat; + } + + public void setViewGnbCat(String viewGnbCat) { + this.viewGnbCat = viewGnbCat; + } + + public String getIsMartCat() { + return isMartCat; + } + + public void setIsMartCat(String isMartCat) { + this.isMartCat = isMartCat; + } +} diff --git a/MyGitSpringProject/src/main/java/com/ruby/codej/RamdaTest.java b/MyGitSpringProject/src/main/java/com/ruby/codej/RamdaTest.java new file mode 100644 index 0000000..ac8200e --- /dev/null +++ b/MyGitSpringProject/src/main/java/com/ruby/codej/RamdaTest.java @@ -0,0 +1,5 @@ +package com.ruby.codej; + +public interface RamdaTest { + public int test(int x, int y); +} diff --git a/MyGitSpringProject/src/main/java/com/ruby/codej/RestTemplateTest.java b/MyGitSpringProject/src/main/java/com/ruby/codej/RestTemplateTest.java new file mode 100644 index 0000000..54cd52c --- /dev/null +++ b/MyGitSpringProject/src/main/java/com/ruby/codej/RestTemplateTest.java @@ -0,0 +1,25 @@ +package com.ruby.codej; + +import java.util.ArrayList; +import java.util.List; + +import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.http.converter.json.MappingJacksonHttpMessageConverter; +import org.springframework.web.client.RestTemplate; + +public class RestTemplateTest { + public static void main(String[] args) { + RestTemplate restTemplate = new RestTemplate(); + + String url = "http://searchapi.qa.tmon.co.kr/api/search/ac/tmxkzm"; + + List> messageConverters = new ArrayList>(); + MappingJacksonHttpMessageConverter map = new MappingJacksonHttpMessageConverter(); + messageConverters.add(map); + restTemplate.setMessageConverters(messageConverters); + + Object bean = restTemplate.getForObject(url, Object.class); + System.out.println("The object received from REST call : " + bean); + + } +} diff --git a/MyGitSpringProject/src/main/java/com/ruby/codej/TestCodeClass.java b/MyGitSpringProject/src/main/java/com/ruby/codej/TestCodeClass.java index 111a044..296ab38 100644 --- a/MyGitSpringProject/src/main/java/com/ruby/codej/TestCodeClass.java +++ b/MyGitSpringProject/src/main/java/com/ruby/codej/TestCodeClass.java @@ -1,8 +1,14 @@ package com.ruby.codej; +import java.time.DayOfWeek; + public class TestCodeClass { public TestCodeClass() { System.out.println("테스트 코드 추가2"); } + + public static void main(String[] args) { + System.out.println(DayOfWeek.FRIDAY); + } } diff --git a/MyGitSpringProject/src/main/java/com/ruby/codej/TestRamdaCode.java b/MyGitSpringProject/src/main/java/com/ruby/codej/TestRamdaCode.java new file mode 100644 index 0000000..13e65db --- /dev/null +++ b/MyGitSpringProject/src/main/java/com/ruby/codej/TestRamdaCode.java @@ -0,0 +1,32 @@ +package com.ruby.codej; + +public class TestRamdaCode { + public static void main(String[] args) { + + System.out.println(useRamdaExcutor()); + + System.out.println(useBaseExcutor()); + } + + + public static int useRamdaExcutor(){ + RamdaTest rTest2 = (x,y)-> {return x + y;}; + + return rTest2.test(3, 54); + } + + public static int useBaseExcutor(){ + + //전통적인 익명 클래스 인스턴스화 + RamdaTest rTest = new RamdaTest() { + + @Override + public int test(int x, int y) { + return x+y; + } + }; + + return rTest.test(3, 54); + + } +} diff --git a/MyGitSpringProject/src/main/java/com/ruby/codej/TestSimple.java b/MyGitSpringProject/src/main/java/com/ruby/codej/TestSimple.java index 0884469..13441e8 100644 --- a/MyGitSpringProject/src/main/java/com/ruby/codej/TestSimple.java +++ b/MyGitSpringProject/src/main/java/com/ruby/codej/TestSimple.java @@ -1,5 +1,28 @@ package com.ruby.codej; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; + public class TestSimple { + public static void main(String[] args) { + + Long groupDeliveryTotal = null; + Map deliveryCondTotal = new HashMap<>(); + deliveryCondTotal.put("3", 333L); + + Long freeDeliveryCount = Optional.ofNullable(deliveryCondTotal.get("0")).map(Long::longValue).orElse(0L).longValue(); + Long groupDeliveryTotalCount = Optional.ofNullable(groupDeliveryTotal).map(Long::longValue).orElse(0L).longValue(); + + + if(groupDeliveryTotalCount > 0){ + System.out.println("존재함: "+groupDeliveryTotal); + }else{ + System.out.println("존재하지 않음"); + } + + + } + } diff --git a/MyGitSpringProject/src/main/java/com/ruby/codej/apples/Apple.java b/MyGitSpringProject/src/main/java/com/ruby/codej/apples/Apple.java new file mode 100644 index 0000000..7da118f --- /dev/null +++ b/MyGitSpringProject/src/main/java/com/ruby/codej/apples/Apple.java @@ -0,0 +1,44 @@ +package com.ruby.codej.apples; + +import java.util.Arrays; +import java.util.List; + +public class Apple { + private String color; + private Integer weight; + + public Apple(String color, Integer weight) { + this.color = color; + this.weight = weight; + } + + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + public Integer getWeight() { + return weight; + } + + public void setWeight(Integer weight) { + this.weight = weight; + } + + + public static void main(String[] args) { + + List inventory = Arrays.asList(new Apple("Red", 100), new Apple("Green", 150), new Apple("Blue", 200)); + + } + + public static void preetyPrintApple(List inventory, AppleFormatter formatter){ + + + return; + } + +} diff --git a/MyGitSpringProject/src/main/java/com/ruby/codej/apples/AppleFormatter.java b/MyGitSpringProject/src/main/java/com/ruby/codej/apples/AppleFormatter.java new file mode 100644 index 0000000..4374fec --- /dev/null +++ b/MyGitSpringProject/src/main/java/com/ruby/codej/apples/AppleFormatter.java @@ -0,0 +1,5 @@ +package com.ruby.codej.apples; + +public interface AppleFormatter { + String accept(Apple a); +} diff --git a/MyGitSpringProject/src/main/java/com/ruby/codej/ramda/module/RamdaApiTest.java b/MyGitSpringProject/src/main/java/com/ruby/codej/ramda/module/RamdaApiTest.java new file mode 100644 index 0000000..5747848 --- /dev/null +++ b/MyGitSpringProject/src/main/java/com/ruby/codej/ramda/module/RamdaApiTest.java @@ -0,0 +1,55 @@ +package com.ruby.codej.ramda.module; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Stream; + +public class RamdaApiTest { + public static void main(String[] args) { + + //testStreamApi(); + testStreamApi2(); + } + + + public static void testRamdaApi(){ + List numbers = Arrays.asList(1,2,3,4,5,6); + + //Java 7 + for(int number : numbers){ + System.out.print(number); + } + + System.out.println("\n-------------------------------------"); + + //Java8 + numbers.forEach((Integer value) -> + System.out.print(value) + ); + System.out.println("\n-------------------------------------"); + + System.out.print("짝수값은 : "); + //Java8 + numbers.forEach((Integer value) -> { + //짝수 + if(value % 2 == 0){ + System.out.print(value); + } + }); + } + + public static void testStreamApi(){ + + List numbers = Arrays.asList(1,2,3,4,5,6); + long count = numbers.stream().filter(num-> num%2 ==0).count(); + System.out.println(count); + + } + + public static void testStreamApi2(){ + Stream numbers = Stream.of(1,2,3,4,5); + numbers.map(num->num*2).forEach(num->System.out.println(num)); + } + + +} diff --git a/MyGitSpringProject/src/main/java/com/ruby/codej/sprint2/Sprint2CodeTest.java b/MyGitSpringProject/src/main/java/com/ruby/codej/sprint2/Sprint2CodeTest.java new file mode 100644 index 0000000..880fff7 --- /dev/null +++ b/MyGitSpringProject/src/main/java/com/ruby/codej/sprint2/Sprint2CodeTest.java @@ -0,0 +1,6 @@ +package com.ruby.codej.sprint2; + +public class Sprint2CodeTest { + public Sprint2CodeTest() { + } +} diff --git a/MyGitSpringProject/src/main/java/com/ruby/codej/sprint2/SprintCodeAPI.java b/MyGitSpringProject/src/main/java/com/ruby/codej/sprint2/SprintCodeAPI.java new file mode 100644 index 0000000..9380618 --- /dev/null +++ b/MyGitSpringProject/src/main/java/com/ruby/codej/sprint2/SprintCodeAPI.java @@ -0,0 +1,7 @@ +package com.ruby.codej.sprint2; + +public class SprintCodeAPI { + public SprintCodeAPI() { + // TODO Auto-generated constructor stub + } +} diff --git a/MyGitSpringProject/src/main/webapp/WEB-INF/spring/root-context.xml b/MyGitSpringProject/src/main/webapp/WEB-INF/spring/root-context.xml index f7a30f0..dde9eac 100644 --- a/MyGitSpringProject/src/main/webapp/WEB-INF/spring/root-context.xml +++ b/MyGitSpringProject/src/main/webapp/WEB-INF/spring/root-context.xml @@ -5,4 +5,12 @@ + + + + + + + +