728x90
반응형
01.자바
01.1 StrategyInJava
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
public class StrategyInJava{
public static void main(String[] args){
List<Integer> numbers = new ArrayList<>();
numbers.add(10);
numbers.add(5);
Collections.sort(numbers, new Comparator<Integet>(){
@Override
public int compare(Integer o1, Integet o2){
return o1 - o2;
}
});
//Collections.sort(numbers, Comparator.reverseOrder());
//Collections.sort(numbers, Comparator.naturalOrder());
System.out.println(numbers);
}
}
02.스프링
- 스프링의 경우에는 너무 많음
import org.springframework.beans.factory.xml.BeanDefinitionParser;
import org.springframework.cache.CacheManager;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import org.springframework.transaction.PlatformTransactionManager;
public class StrategyInSpring{
public static void main(String[] args){
ApplicationContext applicationContext = new ClassPathXmlApplicationContext();
ApplicationContext applicationContext1 = new FileSystemXmlApplicationContext();
ApplicationContext applicationContext2 = new AnnotaionConfigApplicationContext();
BeanDefinitionParser parser;
PlatformTransactionManager platformTransactionManager;
CacheManager cacheManager;
}
}
728x90
반응형
'CS Study > 디자인패턴' 카테고리의 다른 글
22.03.02_템플릿메소드_패턴적용하기 (0) | 2022.03.03 |
---|---|
22.03.02_템플릿메소드패턴_패턴소개 (0) | 2022.03.03 |
22.02.20_전략패턴의장점과단점 (0) | 2022.02.21 |
22.02.20_전략패턴-패턴적용하기 (0) | 2022.02.21 |
22.02.20_전략패턴-패턴소개 (0) | 2022.02.20 |
댓글