PowerPoint 프레젠테이션

Similar documents
Intro to Servlet, EJB, JSP, WS

歯JavaExceptionHandling.PDF

신림프로그래머_클린코드.key

J2EE Concepts

Spring Boot/JDBC JdbcTemplate/CRUD 예제

I T C o t e n s P r o v i d e r h t t p : / / w w w. h a n b i t b o o k. c o. k r

KYO_SCCD.PDF

No Slide Title

Microsoft PowerPoint - Smart CRM v4.0_TM 소개_ pptx

PowerPoint 프레젠테이션

<property name="configlocation" value="classpath:/egovframework/sqlmap/example/sql-map-config.xml"/> <property name="datasource" ref="datasource2"/> *

Connection 8 22 UniSQLConnection / / 9 3 UniSQL OID SET

제8장 자바 GUI 프로그래밍 II

14-Servlet

JavaGeneralProgramming.PDF

rmi_박준용_final.PDF

PowerPoint 프레젠테이션

쉽게 풀어쓴 C 프로그래밊

ibmdw_rest_v1.0.ppt

J2EE & Web Services iSeminar

<C0CCBCBCBFB52DC1A4B4EBBFF82DBCAEBBE7B3EDB9AE2D D382E687770>

슬라이드 1

혼자서일을다하는 JSP. 이젠일을 Servlet 과나눠서한다. JSP와서블릿의표현적인차이 - JSP는 <html> 내에서자바를사용할수있는수단을제공한다. - 서블릿은자바내에서 <html> 을작성할수있는수단을제공한다. - JSP나서블릿으로만웹페이지를작성하면자바와다양한코드가

슬라이드 1

04장

교육2 ? 그림

어댑터뷰

PowerPoint 프레젠테이션

OOP 소개

PowerPoint Presentation

(jpetstore \277\271\301\246\267\316 \273\354\306\354\272\270\264\302 Spring MVC\277\315 iBatis \277\254\265\277 - Confluence)

슬라이드 1

@OneToOne(cascade = = "addr_id") private Addr addr; public Emp(String ename, Addr addr) { this.ename = ename; this.a

표준프레임워크로 구성된 컨텐츠를 솔루션에 적용하는 것에 문제가 없는지 확인

PowerPoint 프레젠테이션

제목

PowerPoint Presentation

초보자를 위한 C# 21일 완성

Microsoft PowerPoint - CSharp-10-예외처리

Web Service Computing

JMF3_심빈구.PDF

Microsoft PowerPoint - 04-UDP Programming.ppt

<4D F736F F F696E74202D20C1A632C8B8C7D1B1B9BDBAC7C1B8B5BBE7BFEBC0DAB8F0C0D32D496E E D56432E BC8A3C8AF20B8F0B5E55D>

제목

본 강의에 들어가기 전

Microsoft PowerPoint - java1-lab5-ImageProcessorTestOOP.pptx

자바-11장N'1-502

중간고사

Spring Data JPA Many To Many 양방향 관계 예제

JAVA PROGRAMMING 실습 08.다형성

Microsoft PowerPoint - JCO2007_Spring2.0_발표자료_Rev-A.ppt [호환 모드]

목차 JEUS EJB Session Bean가이드 stateful session bean stateful sample 가이드 sample source 결과확인 http session에

Microsoft PowerPoint - web-part03-ch19-node.js기본.pptx

2장 변수와 프로시저 작성하기


FileMaker ODBC and JDBC Guide

歯Writing_Enterprise_Applications_2_JunoYoon.PDF

C# Programming Guide - Types

mytalk

Interstage5 SOAP서비스 설정 가이드

Mobile Service > IAP > Android SDK [ ] IAP SDK TOAST SDK. IAP SDK. Android Studio IDE Android SDK Version (API Level 10). Name Reference V

Portal_9iAS.ppt [읽기 전용]

Cluster management software

NCS : ERP(SAP) ERP(SAP) SW IT,. SW IT 01., 05., 06., 08., 15., , 05. SW IT,,,, SAP HR,,, 4,,, SAP ABAP HR SCHEMA, BSP,

(Microsoft PowerPoint - java1-lecture11.ppt [\310\243\310\257 \270\360\265\345])

The Self-Managing Database : Automatic Health Monitoring and Alerting

gnu-lee-oop-kor-lec06-3-chap7

Cache_cny.ppt [읽기 전용]

Chap7.PDF

09-interface.key

제목

목차 BUG DEQUEUE 의 WAIT TIME 이 1 초미만인경우, 설정한시간만큼대기하지않는문제가있습니다... 3 BUG [qp-select-pvo] group by 표현식에있는컬럼을참조하는집합연산이존재하지않으면결괏값오류가발생할수있습니다... 4

JMF2_심빈구.PDF

<4D F736F F F696E74202D20B5A5C0CCC5CDBAA3C0CCBDBA5F3130C1D6C2F75F31C2F7BDC32E >

<param-value> 파라미터의값 </param-value> </init-param> </servlet> <servlet-mapping> <url-pattern>/ 매핑문자열 </url-pattern> </servlet-mapping> - 위의예에서 ServletC

Corporate PPT Template

Microsoft PowerPoint - aj-lecture7.ppt [호환 모드]

02 C h a p t e r Java

13ÀåÃß°¡ºÐ

1217 WebTrafMon II

NoSQL

untitled

개발문서 Oracle - Clob

Network Programming

Web Application을 구성하는 패턴과 Spring ROO의 사례

MasoJava4_Dongbin.PDF

Microsoft PowerPoint - 인소프트.ppt

뇌를 자극하는 JSP & Servlet 슬라이드

PowerPoint 프레젠테이션

파워포인트 템플릿

10.ppt

FileMaker 15 ODBC 및 JDBC 설명서

Spring Batch 2.0 시작하기

12-file.key

Microsoft PowerPoint - Supplement-03-TCP Programming.ppt [호환 모드]

Microsoft PowerPoint - GUI _DB연동.ppt [호환 모드]

서블릿의라이프사이클 뇌를자극하는 JSP & Servlet

JAVA PROGRAMMING 실습 09. 예외처리

4 주차 - SPRING 환경설정및구현 Spring 기반의웹프로젝트를구성하고싶어요 T^T Spring 기반의웹환경구축 1. web.xml 수정으로 Spring 을설정하는방법 2. eclipse Spring Plug-In 을활용한템플릿프로젝트자동구성필수는아니지만해놓으면편

01-OOPConcepts(2).PDF

Transcription:

2012 년자바카페 OPEN 세미나 주제 : Spring 프레임워크중요구성원리 2012. 6. 16

Today Story 1. 티어와레이어 2. 웹프로그래밍과엔터프라이즈프로그래밍 3. MVC 모델과웹개발의흐름 4. Spring 3대구성원리와디자인패턴 5대원리 5. AJAX와데이터처리

Today Story 1. 티어와레이어 2. 웹프로그래밍과엔터프라이즈프로그래밍 3. MVC 모델과웹개발의흐름 4. Spring 3대구성원리와디자인패턴 5대원리 5. AJAX와데이터처리

Tier & MVC BROWESER (CLIENT) REQUEST RESPOND FRONT CONTROL FRONT CONTROL V C V JDNI JMAIL MODEL SERVLET REMOTE LOOKUP HOME EJB CREATE REMOTE JDBC JAVAX.SQL..DATASOURCE POOLING JNDI JMS JTA POOL JDOM LDMP DB MOM APP SERVER LDAP MAIL PL V1 SPAGETTI V2 SEPERATION MVC1(JSP CONTROL) MVC2 (SERVLET) MVC2 (SERVLET ACTION) V1 V2 V1 C V2 V1 V2 V1 V2 C C ACTION SERVER BL SERVICE DL DAO DAO DAO DAO EIS Frameset tiles.sitemesh, Freemaker,velocity

Tier/Layer 화면 Tier Layer Client Tier Browser(JS, HTML, CSS) JSP / Serverlet(controller) v1 v2 PL PL View JSP / Serverlet 화면층 V -> V Server Tier BL 로직층 DL (Persistence Layer) 영속성 JDBC/Driver Single tone delegate DAO Model Ibatis(Hivernate) JDBC/Driver 제어, 분기 Controller MVC EIS Tier DB DB MOM

3 Tier Browser Browser User Client Tier Presentation Layer (JSP/Servlet) 요청을동적으로처리하여 HTML 로응답한다. Business Layer (Service, EJB) 요청을받고, 분석, 실행한다. SQL 을이용하여데이터를얻기도하며요청에대한데이터를응답한다. Server Tier Data Layer (Persistence,Integration Layer : DAO, ORM) SQL 을이용하여정보검색, 추가, 수정, 삭제 (CRUD) 를한다. Resource Layer DB EIS Tier

4 Tier Browser Browser User Client Tier Presentation Tier (JSP/Servlet) Web Server HTML 응답 Server Tier Business Tier (Service, EJB) Data Tier(Persistence, Integration Tier: DAO, ORM) Application Server Application Tier CRUD Resource Tier DB EIS Tier

Today Story 1. 티어와레이어 2. 웹프로그래밍과엔터프라이즈프로그래밍 3. MVC 모델과웹개발의흐름 4. Spring 3대구성원리와디자인패턴 5대원리 5. AJAX와데이터처리

Web Server WS = HTTP Server + Web container + Web Engine +Connector

WAS WAS = WS + ES + SERVICE WS=Tomcat ES HTTPD wc = Containner Engin =jasper E.C E.E Service HTTP Server Jsp -> servlet Connector Ibatis (EJB 대신역할수행 ) ActiveDrectory JMDI JMS JTA JMAIL....(40 개정도 ) Data source Pooling LDAP MOM ASF 35/40 40 개넘는서비스중에 35 정도의서비스가구현되어있음.

Life Cycle web.xml 활동준비 / 자원초기화 Container 가메서드호출 init() Servlet init() Request service() service() Servlet destroy() destroy() Request 처리후 Response Response Servlet 자원회수 / 객체소멸

Today Story 1. 티어와레이어 2. 웹프로그래밍과엔터프라이즈프로그래밍 3. MVC 모델과웹개발의흐름 4. Spring 3대구성원리와디자인패턴 5대원리 5. AJAX와데이터처리

MVC 1 request Controller 2 한행의데이터를 DTO 에저장하여사용 4 Model 3 DB 6 response View 5 1 요청 4 6 응답 처리결과에따라해당화면으로 forward 2 데이터를처리하거나얻는다 5 3 CRUD 실행 처리결과에따라해당 Business 객체를넘겨서화면에출력한다

Web History

SoC(Separation of Concern) 종류 workbean usebean Multi Front Action SERVER PL BL SEPERATION MVC1(JSP CONTROL) MVC2(JSP CONTROL) MVC2 (SERVLET) MVC2 (SERVLET ACTION) V1 V2 V1 C V2 V1 V2 V1 V2 V1 C V2 C C ACTION ACTION forward forward forward forward SERVICE DL DAO DAO DAO DAO DAO EIS frameset tiles.sitemesh, Freemaker,velocity

MVC

MVC

Front Servlet

Action Servlet

MVC JSP Centric

MVC Servlet Centric(Action Servlet)

Spagetti

Separation

MVC Model 1 JSP Centric

MVC Model 2 Servlet Centric

Facade

Action

Listener/Filter Listener 특정행위가발생하면등록된메서드를호출 Context 가호출되기직전 ContextListener 의 initializedcontext() 메서드호출 Filter 가로채기

Today Story 1. 티어와레이어 2. 웹프로그래밍과엔터프라이즈프로그래밍 3. MVC 모델과웹개발의흐름 4. Spring 3대구성원리와디자인패턴 5대원리 5. AJAX와데이터처리

Spring 3 대원리 DI / IoC Spring OCP AOP

Bean POJO Bean LifeCycle 없는것 Setter 와 Getter 로구성된것 DTO UseBean LifeCycle 있는것 Servlet(JSP) EJB LCO

Abstraction Programming

<<interface>>imagic +make() : void +print() : void MagicSquareFactory - magicsquarefactory : MagicSquareFactory - MagicSquareFactory + factory(n : int) : Imagic <<create>> + getinstance() : MagicFactory Singletone MagicSquare #n : int #magic : int[] +AMagic(n : int) +make() : void +printmagic() : void +sumrow(row : int) : int +sumdia() : int +sumantidia() : int +ismagic() : boolean +getmagic() : int[] +print() : void factory(n) : Imagic n 값에따라 Odd Four SixMagicSquare 를생성 MagicSquare abstract class : 이탤릭체로표기추상클래스 -MAgicSquare, 추상메서드 -make() make() 메서드내부에서 OddMagicSquare 를생성후 getmagic() 을이용하여 OddMagicSquare 의 int[][] 를얻어온다 OddMagicSquare FourMagicSquare SixMagicSquare XXMagicSquare +make() : void +make() : void +make() : void +make() : void <<use>>

SixMagicSquare private void addmagic( ){ int n=magic.length; OddMagicSquare odd=new OddMagicSquare(n/2); odd.make(); } int [][] mogi=odd.getmagic(); for(int i=0 ; i<n/2;i++){ for(int j=0;j<n/2;j++){ magic[i][j]+=mogi[i][j]; magic[i][j+n/2]+=mogi[i][j]; magic[i+n/2][j]+=mogi[i][j]; magic[i+n/2][j+n/2]+=mogi[i][j]; } }

SixMagicSquare private void addmagic( ){ int n=magic.length; XXMagicSquare odd=new XXMagicSquare(n/2); odd.make(); } int [][] mogi=odd.getmagic(); for(int i=0 ; i<n/2;i++){ for(int j=0;j<n/2;j++){ magic[i][j]+=mogi[i][j]; magic[i][j+n/2]+=mogi[i][j]; magic[i+n/2][j]+=mogi[i][j]; magic[i+n/2][j+n/2]+=mogi[i][j]; } }

SixMagicSquare private void addmagic(imagic odd){ int n=magic.length; odd.make();. Imagic odd; public void setimagic(imagic odd){ this.odd=odd; } private void addmagic( ){ int n=magic.length; odd.make();.

OOP 5 대원리 1. SRP(The Single Responsibility Principle) - 단하나의책임원리 응집도관련 2. OCP(The Open-Closed Principle) - 개방폐쇠의원리 엔터티, 상속 ( 부모변경지양 ) - A---> B (A 를변경하지않고 B 를변경 ) 3. LSP(The Liskov Substitution Principle) - 리스코프교체원리 - 다형성관련 ( 부모로자식을사용 -> 인터페이스사용권장 ) 4. DIP(The Depend Inversion Principle) - 의존의대상을추상클래스나인터페이스권장 5. ISP(The Interface Segregation Principle) - 인퍼페이스격리원칙 - 필요한메서드만갖는인테페이스를구현하라.

OCP OCP StudentController > StudentServiceImple

LSP StudentController > StudentService LSP DIP StudentServiceImple StudentController > StudentServiceImple

ISP TeacherService StudentService PeopleServiceImple ISP

ISP StudentService TeacherService StudentServiceImple TeacherServiceImple

Relation StudentController SqlMapClientTemplate StudentService StudentDao SqlDaoSupport StudentServiceImple StudentDaoImple

Controller public class BoardListController extends AbstractController { private BoardRepService boardrepservice; public void setboardrepservice(boardrepservice boardrepservice) { this.boardrepservice = boardrepservice; } protected ModelAndView handlerequestinternal( HttpServletRequest request, HttpServletResponse response) throws Exception { List<BoardRepDto> list=null; list=boardrepservice.getallboards(); return new ModelAndView("list", "lists", list); } }

Service public class BoardRepServiceImp implements BoardRepService { private BoardRepManager boardrepmanager; public void setboardrepmanager( BoardRepManager boardrepmanager ) { this.boardrepmanager = boardrepmanager; } public int deleteboard(int seq) { return boardrepmanager.deleteboard(seq); } public int deleteboards(int[] seq) { return boardrepmanager.deleteboards(seq); }

Dao public class BoardRepManagerImp extends SqlMapClientDaoSupport implements BoardRepManager { public BoardRepDto getboard(int seq) { BoardRepDto dto=new BoardRepDto(); dto= (BoardRepDto)this.getSqlMapClient(). queryforobject("board.getboard", seq); return dto; }

Wiring <bean id="boardlistcontroller" class="com.board.controller.board.boardlistcontroller" p:boardrepservice-ref="boardrepservice"> </bean> <bean id="boarduserservice" class="com.board.serviceimp.boarduserserviceimp" p:boardusermanager-ref="boardusermanager"> </bean> <bean id="boardrepmanager" class="com.board.daoimp.boardrepmanagerimp" p:sqlmapclient-ref="sqlmapclient" /> <bean id="sqlmapclient" class="org.springframework.orm.ibatis.sqlmapclientfactorybean" p:datasource-ref="datasource" p:configlocation="/web-inf/sqlmap/sqlmapconfig.xml"/>

3.X Controller @Controller public class JHBoardController { @Autowired private IJUserService ijuserservice; @RequestMapping(value = "/registry.do", method = RequestMethod.POST) public String registry(juser dto,model model) { logger.info("welcome JHBoardController registry.do!"+ new Date()); logger.info("welcome JHBoardController "+ dto); ijuserservice.addjuserandroll(dto); return "redirect:/index.do"; }//

3.X Service @Service public class JUserServiceImple implements IJUserService { @Autowired private IJUserDao ijuserdao; @Override @Transactional public void addjuserandroll(juser juser) { ijuserdao.addjuser(juser); ijuserdao.addjrollmap(juser); }

3.x Dao @Repository public class JUserDaoImple implements IJUserDao { @Autowired private SqlMapClientTemplate sqlmapclienttemplate;public SqlMapClientTemplate getsqlmapclienttemplate() { return sqlmapclienttemplate; } @Override public void addjuser(juser dto) throws DataAccessException{ getsqlmapclienttemplate().insert("jusermap.addjuser",dto); } @Override public void addjrollmap(juser dto) throws DataAccessException{ getsqlmapclienttemplate().insert("jusermap.addjrollmap",dto); }

Auto Wiring Config <mvc:annotation-driven /> <context:component-scan base-package="com.hankyung.boards com.hankyung.datemans" />

AOP CC CCC P1 P2 P3 P4 weaving

JDBC Transaction public boolean addjuserandroll(juser juser) { Connection conn=null; boolean iss=false; boolean ist=false; try { conn=getconnection(); conn.setautocommit(false); iss=addjuser(juser,conn); ist=addroll(juser,conn); if(iss&&ist){ conn.commit(); }else{ throw new SQLException(" 등록실패 "); } } catch (SQLException e) { try { conn.rollback(); } catch (SQLException e1) { } }finally{ try { conn.setautocommit(true); } catch (SQLException e) { } this.close(conn, null, null); } return iss&&ist; } public boolean addjuser(juser juser,connection con) throws SQLException{ int count=0; String sql=" INSERT INTO J_USER(ID,NAME,PWD,ADDRESS,PHONE)" + " VALUES(?,?,?,?,?)"; Connection conn=null; PreparedStatement psmt=null; try { conn=con; log("2/6 S addjuser "); psmt=conn.preparestatement(sql); public boolean addroll(juser juser,connection con) throws SQLException{ int count=0; String sql=" INSERT INTO J_ROLLMAP(ROLLMAPID,ID,ROLLID)" + " VALUES(J_ROLLMAP_SEQ.NEXTVAL,?,3)"; Connection conn=null; PreparedStatement psmt=null; try { conn=con; log("2/6 S addroll "); psmt=conn.preparestatement(sql); int i=1; psmt.setstring(i++, juser.getid()); log("3/6 S addroll "); count=psmt.executeup

Transaction 3.x @Override @Transactional public void addjuserandroll(juser juser) { ijuserdao.addjuser(juser); ijuserdao.addjrollmap(juser); } <bean id="transactionmanager" class="org.springframework.jdbc.datasource.datasourcetransactionmana ger"> <property name="datasource" ref="datasource"/> </bean> <tx:annotation-driven transaction-manager="transactionmanager"/>

Transaction 2.5 <tx:advice id="transactionadvice" transactionmanager="transactionmanager"> <tx:attributes> <tx:method name="get*" read-only="true" /> <tx:method name="*" propagation="required" rollbackfor="org.springframework.dao.dataaccessexception" /> </tx:attributes> </tx:advice> <aop:config proxy-target-class="true"> <aop:advisor advice-ref="transactionadvice" pointcut="execution(* com.hankyung.boards.model.*service.*(..))" /> </aop:config>

ORM

MyBatis

Spring MVC Web Container 1 Web. XML 3 HendleMapper 에의해 a.do 이면 Custcontroll 을부름 : Mapping 6 딸깍 XML 5 Spring Container Control Controller<interface> 2 Spring Context 리스너하면자동으로읽고들어감 Listener M XML MVC 에자동으로 XML 을이동해줌 이벤트감지 리스터를이용해 XML 을읽음 V,C 4 5 X M L 8 DispacherServlet 딸깍 Titles Resolver JSTL Resolver - sitemash 사용 JSON Resolver View 7 MAV 9 a.do Service Dao 조합 Interface DaoSupport 상속해서 templete 사용 3.0 에서는 @repository 로사용 5 Injection 해줌 Dao XML XML 에등록만해주면 Templet 이준비됨 Model XXXXCustController.java Interface extends Extends 하면자동으로옴 Ver 2.5 Daosuport 강제로올려줌 Templet Ibatis DTO SQL SqlMapConfig.xml CustUser.xml Polling 에서준비된것을사용하는것 리스너종류 Context Session Templet ORM 계열과 Mapping 할수있는 Templet - 환경변수 (xml) 에정의해주면됨 만능커넥터 Sqlmap -ibatis Spring... DataSource Polling connection

Today Story 1. 티어와레이어 2. 웹프로그래밍과엔터프라이즈프로그래밍 3. MVC 모델과웹개발의흐름 4. Spring 3대구성원리와디자인패턴 5대원리 5. AJAX와데이터처리

Round Trip

AJAX Data CSV @@@Jungbo,15400,1100@@Hankyung,26200,1000@@@ XML <kosdaq> <stock> <stockname>jungbo</stockname> <stockprice>15400</stockprice> <prevstockprice>1100</prevstockprice> </stock> <stock> <stockname>hankyung</stockname> <stockprice>26200</stockprice> <prevstockprice>200</prevstockprice> </stock> </kosdaq>

AJAX Data JSON { kosdaq : { stock : [ } } { stockname : Jungbo, stockprice : 15400, prevstockprice : 1100 }, { stockname : Hankyung, stockprice : 26200, prevstockprice : 1000 } ]