Spring

OUO·2022년 1월 11일
0
post-thumbnail


<스프링 기본 디렉토리 구조>

project 생성

왼쪽 위 file-new-spring legaucy project

controller 수정

pom.xml

spring 기본 java-version은 1.6 -> 1.8로 수정
project 선택 maven-update project

필요한 API : https://mvnrepository.com/ ← 여기서 검색 후 pom.xml 파일에 붙여넣기 -> API 수정 쉬움

DB연동을 위한 API : mysql,mybatis,mybatis spring, spring jdbc


스프링이 실행될때 contextloaderlistener가 가장 먼저 실행되고, dispatcher가 실행되는데 두개의 클래스가 참조하는 xml file이 root-context, servlet-context


WEB-INF안에 폴더 만들어서 file추가

servlet-context.xml

db.properties 파일 연결

root-context.xml*



db properties 파일을 연결 하는 객체
maven Dependencies - spring-beans - org.springframework.beans.factory.config - PlaceholderConfigurerSupport.class



maven Dependencies - spring-jdbc - org.springframework.jdbc.dataSource - SimpleDriverDataSource.class



maven Dependencies - mybatis-spring - org.bybatis.spring - SqlSessionFactoryBean

profile
develoops!er

0개의 댓글