Spring 연결
1. 프로젝트 만들기
src/main/java
src/main/resources
wepapp 변경, web.xml 체크하고 Finish.
2. Configure - Maven으로 변경
3. pom.xml
- Spring dependencies 추가
4. web.xml
- DispatcherServlet 정의, Context Listener 등록, 인코딩 처리
5. /WEB-INF/spring-servlet.xml
- Annotation, Controller 설정
6. /WEB-INF/applicationContext.xml
7. jsp, Controller 작성
8. Tomcat에 올림
9. 돌아가는지 확인
DB 연결
1. pom.xml
- Oracle, JDBC, MyBatis 추가. Oracle은 repository도 추가해주어야 함.
2. applicationContext.xml
- Oracle 접속설정, MyBatis SqlSession 추가.
3. mybatis packages
java/main/resources 아래 mybatis, mybatis.mappers 추가
폴더로 나오면 -> properties - Java Build Path - Source - Excluded Remove.
4. configuration.xml
mybatis 아래 configuration.xml - mappers 경로 정의
5. queries
mybatis.mappers 아래 알맞은 쿼리 xml 파일 작성
파일 업로드
1. pom.xml
Jackson, commons fileupload 다운
2. spring-servlet.xml
mvc:annotation-driven 밑에 message-converter 추가
multipartResolver 추가
url 매핑 추가
'공부 > Java' 카테고리의 다른 글
Spring MultipartFile null 확인 (0) | 2018.02.14 |
---|---|
Spring Autowired 주의 (0) | 2018.02.14 |
MyBatis) java.sql.SQLSyntaxErrorException: ORA-00911: invalid character (0) | 2018.02.13 |
Spring) org.springframework.beans.factory.NoSuchBeanDefinitionException (0) | 2018.02.13 |
Mybatis / java.lang.NumberFormatException: For input string: " " (0) | 2018.02.12 |