본문 바로가기

분류 전체보기84

[Programmers/java/python][스택/큐] 기능개발 프로그래머스 [스택/큐]기능개발 링크​javaimport java.util.ArrayList;​class Solution { public int[] solution(int[] progresses, int[] speeds) {​ ArrayList list = new ArrayList(); int temp = 0; int count = 0; int length = progresses.length;​ for (int i = 0; i = day) { count++; } else { if (count> 0) list.add(count); temp .. 2021. 9. 13.
[TI...] 조금이라도 기억에 남겨보기 2021. 8. 24.
Java config를 이용하여 스프링 컨테이너(ApplicationContext) 설정하기 Java config를 이용한 설정 어노테이션 jdk 5부터 지원되었다. @Configuration 스프링 설정 클래스를 선언하는 어노테이션 AnnotationConfigContext 객체는 자바 config 클래스를 읽어들여서 IoC와 DI를 적용하게 된다 @Bean bean 클래스를 정의하는 어노테이션 설정 파일 내 메서드 형태로 작성한다. 메서드의 이름은 xml 파일에서 Bean을 등록할 때, id와 같은 역할을 한다. AnnotationConfigContext는 해당 어노테이션이 붙은 메소드들을 자동으로 실행하며, 리턴값인 객체들을 싱글톤 패턴(default)으로 관리한다 컨테이너의 getBean() 메소드로 빈 객체를 불러올 때, 파라미터로 메소드 명 혹은 클래스를 전달한다. Car car = .. 2021. 7. 10.
스프링 Ioc/DI 컨테이너 사용 (xml 파일 이용) 스프링 IoC/DI 컨테이너 활용 XML을 이용한 방식 src/main/resources 경로 아래 xml 파일로 스프링 컨테이너에 전달할 정보를 작성한다. 스프링이 버전 업 되면서 더 편한 방식이 등장하고 있다. → 어노테이션과 Config를 이용한다. applicationContext.xml 예시 IoC 예시 // UserBean 클래스 코드는 생략 // 다만, 빈 클래스 특징에 적합하도록 작성한다. package kr.or.connect.diexam01; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public c.. 2021. 7. 8.