Spring
-
04. SLF4J와 Logback을 이용한 로그 남기기 [Spring]Spring 2016. 11. 3. 15:19
JAVA 에는 많은 로깅툴이 존재함.- commons-logging- log4j - java util logging- logback commons-logging 제외시키기porn.xml에서 spring.webmvc 밑에 commons-logging commons-logging SLF4J와 Logback 추가하기porn.xml에서 org.slf4jjcl-over-slf4jlogback-classic 추가하기 잘 나오지 않을때window - Preferences - Maven - Download repository index updates on startup 클릭 Loogback 설정하기src/main/resources 에 logback.xml file생성 ▶ %-5level %d{HH:mm:ss.SSS} ..
-
03. 커맨드 객체 값 검증과 에러 메시지, Interceptor [Spring]Spring 2016. 11. 3. 11:03
01. 커맨드 객체 값 검증과 에러 메시지 pom.xml 에valiation-apihibernate-validator 추가 기존 form 태그를 form:form 으로 교체- commandName : form의 ID- method : form 의 Method- action : form 의 Action 사번 : 이름 : 이메일 : 직무번호 : indexController 에서@RequestMapping("hr/doAddEmployeeAction") public ModelAndView doAddEmployeeAction(@Valid EmployeesVO employee, Errors errors) {ModelAndView view = new ModelAndView();if( errors.hasErrors()..
-
02-3. ORM : MyBatis (Parameter 받기) [Spring]Spring 2016. 11. 2. 13:50
Param 가져오는법request.getParameter@RequestParam@pathVariable URL 에 Parameter를 주고싶을때는?k=v 으로 한다이러한걸 Query Param 라고 부른다이렇게 넘길때는@RequestParam(required = false, defaultValue = "") 을 적어야 한다. Spring은 /hr/employees/100 이라고도 표현가능이러한걸 pathParam 이라고 부른다이렇게 넘길때는 @PathVariable 을 적어줘야 한다. indexDaoSELECT/* [indexDao.xml] [getEmployeeByEmployeeId] */EMPLOYEE_ID employeesId, FIRST_NAME firstName, LAST_NAME lastNam..
-
Invalid LOC Header 오류 해결법Spring 2016. 11. 2. 10:13
서버를 실행할때 Tomcat 8.0 뭐시기 뭐시기가 나온다면 프로젝트 마우스 오른쪽 버튼 -> Run as -> Maven Clean 클릭 프로젝트 마우스 오른쪽 버튼 -> Run as -> Maven install 클릭 하면 ERROR 라는 에러가 나올 것이다. 나의 경우는ERROR 에 C:/USER/206-001/.m2/repository/.com/ojdbc6 이 나와 경로르 따라 들어가 .com을 지운후 프로젝트 마우스 오른쪽 버튼 -> Maven -> update Project 클릭 하면 됩니다
-
02-2. ORM : MyBatis 연동하기 (Mapper, Configration ) [Spring]Spring 2016. 11. 2. 09:52
Mapper 설정src/main/java -> dao -> impl -> sql 에 indexDao.xml 이름으로 file 생성 //namaspace -> 파일명 SELECT/* [indexDao.xml] [getNowDateTime] */SYSDATEFROM DUAL IndexDaoImpl에 있는public String getNowDateTime() {return getSqlSession().selectOne("indexDao.getNowDateTime");} // indexDao은 namespace getNowDateTime 은 select id이다 Configration 생성src/main/resource -> mybatis.xml 이름으로 file 생성 Configration 설정 rootCon..
-
02-1. ORM : MyBatis 연동하기 (MyBatis, Connection Pool, ojdbc6) [Spring]Spring 2016. 11. 1. 16:55
설정하기 Depandencies에서commons-dbcp 추가ojdbc6 추가 (.xml에서 직접 작성) porn.xml에서 commons-dbcp commons-dbcp 1.4 oracle ORACLE JDBC Repository http://maven.jahia.org/maven2 com.oracle ojdbc6 11.1.0.7.0 rootContext.xml에서 web.xml에서(Ctrl + Space 눌러서 ContextLoaderListener 선택)contextConfigLocation/WEB-INF/spring/*Context.xml MyBatis Dependency 추가하기porn.xml -> Depandencies 에서 add버튼 클릭후 추가mybatis-springmybatissprin..
-
01. Spring 설정하기 [Spring]Spring 2016. 11. 1. 14:30
IOC -> 소프트웨어를 어떻게 설계를 할 것인가?Inversion Of Control ( 제어(객체생성에 대한)의 역전 )└누가? Bean Container└ 구체화└ 추상화 -> 외부 ( Properties, json, xml, text )└누구로부터? Source Code (New)Application에서 New를 사용하지않고 외부로부터 Class생성하고 Application으로 주입한다. 하는 이유 : 1. 다형성 -> 하나의 인터페이스가 여러개의 biz로 쪼개지는것(유지보수가 쉽다)ex) LoginInterFace -> 회원가입, 로그인, 로그아웃 2. 모듈화 DI -> IOC의 구체적 구조 or IOC의 실체화Dependency Injection Maven Repositories 설정Windo..