반응형

가끔 찾아보기가 귀찮아서.. ㅡㅡ;

  1. try {
  2.       BufferedReader in = new BufferedReader(new FileReader("src/input"));
  3.       String s;
  4.       while ((s = in.readLine()) != null) {
  5.         System.out.println(s);
  6.       }
  7.       in.close();
  8.     } catch (IOException e) {
  9.         System.err.println(e);
  10.         System.exit(1);
  11.     }
  12. }


728x90
반응형

'Development > Java' 카테고리의 다른 글

Deep Copy vs Shallow Copy  (0) 2013.02.12
객체에는 메서드가 포함되지 않는다?  (0) 2013.02.12
[Spring]Spring Annotation  (0) 2012.08.01
[Spring]SpEL(Spring Expression Language)  (0) 2012.07.31
[Spring]Autowiring  (0) 2012.05.03
반응형
tar cvf 만들파일명 만들대상

ex) tar cvf test.tar test
test 디렉터리 안에 내용을 test.tar 파일로 만든다

c - 파일 생성
v - 작업내용 표시
f - 대상 지정
728x90
반응형

'Development > Linux' 카테고리의 다른 글

Command Line 명령어  (0) 2016.01.14
sed 명령어  (0) 2016.01.12
[Unix]vi 편집기  (0) 2012.04.20
[Unix]기본명령어  (0) 2012.04.17
[Unix]Unix 구조  (0) 2012.04.17
반응형

1. 속성 정의 XML 파일에 추가되어야 하는 정의 

 xmlns:context="http://www.springframework.org/schema/context“
                                  http://www.springframework.org/schema/context
                                  http://www.springframework.org/schema/context/spring-context-3.0.xsd">  
                <context:annotation-config/>       
Spring Container가 Annotation을 인식하기 위해서는 Spring Container에 BeanPostProcessor들이 등록되어있어야한다. <context:annotation-config/>을 추가하면 내부적으로 자동 등록된다.

2. Stereotype
- @Service : Business Layer를 구성하는 서비스 클래스 대상
- @Repository : Data Access Layer를 구성하는 클래스 대상
- @Controller : 프레젠테이션 Layer를 구성하는 클래스 대상, Spring MVC 기반의 경우에 한하여 사용

3. Dependencies
- @Inject, @Autowired, @Resource : 특정 Bean의 비지니스 기능 수행을 위해 다른 Bean을 참조할경우 사용
- @Inject (javax.inject-xxx.jar)
  멤버변수, setter 메소드, 생성자, 일반 메소드에 정의
- @Autowired : Framework에 종속적
- @Resource (jsr250-api.jar)
  멤버변수와 setter 메솓에 정의할수 있음

@Inject 

 @Autowired

@Resource 

type-driven injection 방식  type-driven injection 방식  

name-matching injection 방식  

JSR-330표준, Framework에 종속되지 않음 

 Spring Framework에 종속적   JSR-2500표준, Framework에 종속되지 않음
 @Named 이용하여 특정 빈 지정

@Qualifier를 이용하여 특정 빈 지정 

 Annotation 내에 name 속성을 통해 특정 빈 지정

 멤버변수, setter메소드, 생성자, 일반메소드

   멤버변수, setter메소드, 생성자, 일반메소드    멤버변수, setter메소드

 @Inject 사용을 권장


4. Auto-Detection
- <context:component-scan> 정의 필요
- 클래스패스 상에 존재하는 클래스들을 스캔하여 Stereotype Annotation이 정의된 클래스들과 필터와 비교하여 매칭되는 클래스들을 Bean으로 인식하여 자동으로 등록

 <context:component-scan base-package="패키지명" />

5. TestCase
- @RunWith : SpringFramework에서 Junit4.5+와의 연계를 위해 제공하는 SpringJUnit4ClassRunner클래스로 정의
- @ContextConfiguration : ApplicationContext 생성시 필요한 속성정의 파일 위치 명시


728x90
반응형

'Development > Java' 카테고리의 다른 글

객체에는 메서드가 포함되지 않는다?  (0) 2013.02.12
파일 입출력.  (0) 2013.01.29
[Spring]SpEL(Spring Expression Language)  (0) 2012.07.31
[Spring]Autowiring  (0) 2012.05.03
[Spring]AOP 주요 구성요소  (0) 2012.04.13
반응형

SpEL
- Expression Languege중 하나, 런타임시 특정 객체의 정보에 접근하거나 조작할수 있도록 지원.

1. XML 기반 Bean 정의시

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> 
        <property name="driverClassName" value="#{contextProperties.driver}"> 
        <property name="url" value="#{contextProperties.url}"> 
        <property name="username" value="#{contextProperties.username}"> 
        <property name="password" value="#{contextProperties.password}"> 
</property></property></property></property></bean>

classpath상에 존재하는 context.properties파일을 로드하여 bean으로 정의한 후 driver, url 등의 정보를 추출함.

2. Annotation 기반 Bean 정의시

  1. @Repository(“movieDao")
  2. public class MovieDao extends SimpleJdbcDaoSupport {
  3.  
  4.        @Value("#{contextProperties['pageSize'] ?: 10}")
  5.        int pageSize;
  6.        @Value("#{contextProperties['pageUnit'] ?: 10}")
  7.        int pageUnit;
  8.        @Inject
  9.        public void setJdbcDaoDataSource(DataSource dataSource) throws Exception {
  10.                  super.setDataSource(dataSource);
  11.        }
  12. }
@Value라는 Annotation과 함께 Expression정의 (값이 없을 경우 10으로 셋팅)

728x90
반응형

'Development > Java' 카테고리의 다른 글

파일 입출력.  (0) 2013.01.29
[Spring]Spring Annotation  (0) 2012.08.01
[Spring]Autowiring  (0) 2012.05.03
[Spring]AOP 주요 구성요소  (0) 2012.04.13
[Spring]Spring Bean Scope  (0) 2012.04.09
반응형

- Autowiring 이란
  Spirng container가 bean 간의 참조관계를 자동으로 연결해주는 기능

- 속성값
 1. no : 기본값
 2. byName : property 명과 동일한 id 또는 name을 가진 bean
 3. byType : 동일한 클래스타입,(같은 타입 여러개 존재시 exception 발생)
 4. constructor : byType과 비슷하나 생성자인자에 적용
 5. autodetect : constructor 모드 수행후 byType 모드 수행
 6. default : 최상위 태그인 <beans> 에 셋팅한 모드가 수행됨. (default-autowire 속성)


Setter Injection 사용시

  1. <bean id="firstBean" class="“org.anyframe.exercise.dependencies.FirstBean">
  2.     <property name="”secondBean”" ref="”secondBean”/"></property></bean>
  3.     <bean id="secondBean" class="“org.anyframe.exercise.dependencies.SecondBean/">
  4. </bean>
Autowire 사용시
  1. <bean id="firstBean" class="“org.anyframe.exercise.dependencies.FirstBean" autowire="byType">
  2.     <bean id="secondBean" class="“org.anyframe.exercise.dependencies.SecondBean/">
  3. </bean></bean>

특정 bean을 autowiring 제외시키려면

  1. <bean id="bean" class="“org.anyframe.test.TestBean”" autowire-candidate="false"> </bean>


728x90
반응형

'Development > Java' 카테고리의 다른 글

[Spring]Spring Annotation  (0) 2012.08.01
[Spring]SpEL(Spring Expression Language)  (0) 2012.07.31
[Spring]AOP 주요 구성요소  (0) 2012.04.13
[Spring]Spring Bean Scope  (0) 2012.04.09
[Spring]Dependency Injection  (0) 2012.03.21
반응형

1. 커서이동

- 왼쪽, 오른쪽, 위, 아래 : h, i, k, l
- 다음라인 첫문자로 이동 : +
- 위라인 첫문자로 이동 : -
- 현재라인 맨 첫문자로 이동 : 0
- 현재라인 맨 뒷문자로 이동 : $
- 제일 마지막 라인 맨 첫문자로 이동 : G

2. 입력

- 현재 커서 위치에 입력 : i
- 현재 커서 위치에 오른쪽에 입력 : a
- 현재 라인 아래 새로운 라인 추가 : o
- 현재 라인 첫문자 앞에 입력 : ㅣ
- 현재 라인 마지막에 입력 : A
- 현재 라인 앞에 새로운 라인 추가 : O

3. 삭제

- 현재 커서 위치에 있는 1개 문자 삭제 : x
- 현재 커서 앞에 있는 1개 문자 삭제 : x
- 현재 커서 위치부터 단어 끝가지 삭제 : dw
- 현재커서 위치부터 단어 처음까지 삭제 : db
- 현재 커서 위치의 라인 삭제 : dd
- 현재 커서 위치부터 라인 끝까지 삭제 : D
- 현재 라인부터 파일 마지막 라인까지 삭제 : dG

3. 취소/반복

- 바로전 실행 명령 취소 : u
- 현재 라인에서 실행한 모든 명령 취소 : U
- 바로전 실행한 명령 재실행 : .

4. 종료

- :wq : 파일을 저장한 뒤 종료
- :q! : 강제종료. 저장안함.


728x90
반응형

'Development > Linux' 카테고리의 다른 글

Command Line 명령어  (0) 2016.01.14
sed 명령어  (0) 2016.01.12
[Unix]tar 명령어  (0) 2012.11.12
[Unix]기본명령어  (0) 2012.04.17
[Unix]Unix 구조  (0) 2012.04.17
반응형

- chmod : 권한 변경
chmod 8진수 표기 filename
u:사용자 허가권        g:그룹 허가권,     o:타 사용자 허가권,     a:모두
+ : 허가권 추가        - : 허가권 삭제        = : 허가권 절대적 할당
r:읽기                     w:쓰기     x:실행

- chown : 파일 소유자 변경
chown user_id filename

- touch : 파일 날짜 및 시간을 현재시간으로 변경
touch filename

- mv : 파일을 이동하거나 이름변경
mv sourcefile targetfile

-cp :파일 복사
cp[option] sourcefile targetfile
option 
    -i : 이미 존재할경우 덮어쓸지 물어봄
    -p : 이미 존재할 경우 기존 파일의 속성 시간 그대로 유지
    -r : 하부 디렉토리 까지 복사

-rm : 파일 삭제
rm[option] filename
    -i : w 권한 없을때 삭제할것인지 물어봄
    -f : w 권한 없어도 삭제
    -r : 하부 디렉토리 까지 삭제

-find : 파일 찾기
find starting-dir criteria acitons
ex>find /test -name *.txt -print

-head : 파일 내용 보기(1부터 n줄까지) / tail : 파일 내용보기 (끝에서 n까지)
head [-n] filename

- cat  : 파일 전체 내용 출력
cat [option] filename 

- more : 파일 내용을 한 화면씩
more filename

- wc : line 수, word 수, 문자수에 대한 정보출력
wc [option] filename
    -l : 라인수 
    -w : word 수
    -c : 문자수

-grep : 파일내 특정 패턴 검색하여 그 행을 화면에 출력
grep[option] 패턴 filename
    -i : 대소문자 무시하고 출력
    -l : 패턴에서 일치하는 파일명만 출력
    -c : 일치하는 패턴을 포함한 라인수
    -n : 라인번호 붙여서 출력

-tr : 지정한 데이터로 변환해서 출력
tr 원래문자 바꿀문자 < filename

-cmp : 두개 파일 틀린위치 출력
cmp filename1 filename2

-pcat : pack 명령으로 압축된 파일을 풀지않고 내용을 볼수 있게 한다.
pcat filename.z

728x90
반응형

'Development > Linux' 카테고리의 다른 글

Command Line 명령어  (0) 2016.01.14
sed 명령어  (0) 2016.01.12
[Unix]tar 명령어  (0) 2012.11.12
[Unix]vi 편집기  (0) 2012.04.20
[Unix]Unix 구조  (0) 2012.04.17
반응형

1. Kernel

- Unix 시스템에 존재하는 시스템 자원을 관리한다.

- Unix 운영체제가 다중사용자, 다중프로세스를 지원하기때문에 프로세스를 분배해주고 보호해줘야함.

- 메모리관리, 프로세스관리, 파일관리, 입출력관리, 프로세스간상호통신(IPC:Inter-Process Communication)


2. Shell

- 하나의 프로그램. 커널이 최초로 사용자에게 할당해주는 무한루프 프로그램

- 쉘은 커널과 사용자 사이의 인터페이스 역할을 한다.

728x90
반응형

'Development > Linux' 카테고리의 다른 글

Command Line 명령어  (0) 2016.01.14
sed 명령어  (0) 2016.01.12
[Unix]tar 명령어  (0) 2012.11.12
[Unix]vi 편집기  (0) 2012.04.20
[Unix]기본명령어  (0) 2012.04.17
반응형

Core Concerns : 특정 시스템의 핵심 가치와 고유 목적이 그대로 드러난 관심영역

Crosscutting Concerns ; 로깅, 보안, 트랜잭션 관리등과 같이 여러 모듈간 공통적으로 적용되는 공통 관심영역

1. JoinPoint

- Crosscutting Concerns 모듈이 삽입되어 실행될수 있는 특정 위치

- 제어 흐름중의 한 시점(메소드 호출시점, 예외 던져지는 시점등)

2. PointCut

 - JoinPoint 중 AOP를 적용하기 위한 선별된 JoinPoint

 - Pattern Matcing과 PointCut Designator를 묶어 룰을 정함.

3. Advice

 - JoinPoint에 삽입되어 동작할 수 있는 코드

 - 동작시점 

   before : Matching 된 JoinPoint 이전에 동작하는 Advice

   after returning : Matching  된 JoinPoint가 성공적으로 return 된 후 동작하는 Advice

   after throwing : Matching  된 JoinPoint가 Exception 이 발생하여 종료된 후 동작하는 Advice

   after  : Matching  된 JoinPoint가 종료된후 동작하는 Advice

   around ; Matcing 된 Joinpoint 전후에 동작

4. Weaving 

 - Core Concerns 모듈에 Crosscutting Concerns 모듈 역어서 동작수행

5. Aspect

 - 어디에서(Pointcut) 무엇을 할 것인지(Advice)를 합쳐놓은것을 말함


728x90
반응형

'Development > Java' 카테고리의 다른 글

[Spring]SpEL(Spring Expression Language)  (0) 2012.07.31
[Spring]Autowiring  (0) 2012.05.03
[Spring]Spring Bean Scope  (0) 2012.04.09
[Spring]Dependency Injection  (0) 2012.03.21
[Spring in Action]DispatcherServlet 구성  (0) 2011.10.25

+ Recent posts