본문 바로가기
Spring

[Spring]

by whitedeveloper 2022. 10. 28.

사용이유

- EJB 너무 무겁다.

 

ioc

-di -

-dl - datasource

 

AOP

-관점지향

-기능을 나눔 -유지보수 용이

  -핵심관점 - @Target, 

  -공통관점 - @Advice, 

- @joinPoint -언제 실행될지 

- @Pointcut -어떤 메서드를 어떤 곳에 적용 - pattrn

 

POJO

-자바 클래스, 특정 인터페이스에 종속적이지 않음

 

 

interface 기반 loose coupling 가능

 

 

DI - Dependency injection

injection  받는 방법

-xml

-anotaion

-java code

 

bean -scope 사용가능 - 생략시.싱글톤

 

객체 생성 - 빈설정

빈의 생성범위 - singleton, prototype, request, session

 

property - 자식 엘리먼트 injection

 

선언한 순서

지정한 순서 - index

 

annotaion하는 법

@Component - container에 관리가 되야하는 대상 - 내가 작성한 클래스

  >>@Autowired - 메서드, 생성자, 프로퍼티

 

 

 

@Bean - datasource

 

spring mvc

web.xml

contextparam - root-context.xml의 위치- 비웹 관련 설정(DB, aop, )

DispatcherServlet - 설정 - servlet-context.xml위치 - 웹 관련 설정(controller), resources, view resovle, interceptor , file upload

 

 

사용자 요청 > Dispatcherservlet-url패턴 체크 - handler mapping  > 해당 controller > service > repository(mybatis - mapper) > controller - 응답결과 설정-model(응답데이터),modelandView, >  Dispatchservlet > viewresolve - view객체 생성

 > controller > view

 

controller return 타입

-void

-string

spring 기본 forward

redirect - redirectAttribute

 

 

framework장점

결합도는 낮게 응집도는 높게

 

 

Anototion

사용자 요청 처리

-동기처리

@Controller

@RestController -비동기처리 가능

 

aop

-before after around 개념

 

Mybatis - root-context.xml

jdbc 작업 > 반복작업 제거

-mapper

sqlsession

select insert last_id?

 

sqlsession 메서드 규칙

id 메소드 명과 일치

파라미터 - 메소드 아규먼트

 

restcontroller - openapi

-crud post get put delete

 

 

 

 

 

 

 

spring 프레임워크 개념 등등

ioc di 빈 설정방법

빈 설정관련 class mapping - 기존 지정

스프링mvc 아키텍쳐 세은님 그림 - 그릴 수 있어야

xml설정

주요 어노테이션

마이바티스

rest controller 개념

spring boot - 성능향상 x 개발환경 개선 o

 

 

 

 

 

 

 

 

'Spring' 카테고리의 다른 글

[Spring]SpringBoot  (0) 2022.10.31
[Spring]lombok  (0) 2022.10.28
[Spring]Rest  (0) 2022.10.28
[Spring]Mybatis- SqlSessionFactory  (0) 2022.10.25
[Spring]Spring JDBC, DataSource  (0) 2022.10.25