본문 바로가기

Java & SpringFramework

[SpringFramework] Transaction 설정 방법 - web.xml contextConfigLocation /WEB-INF/spring/root-context.xml , /WEB-INF/spring/context-datasource.xml , /WEB-INF/spring/context-transaction.xml 위와 같은 설정파일 추가 및 수정예정 - servlet-context.xml context:component-scan에 Controller만 스캔함 - root-context.xml context:component-scan에 Controller를 제외한 Service등 스캔함 - context-datasource.xml jdbc 설정 - context-transaction.xml Service의 메서드명이 insert, update, delet.. 더보기
[SpringFramework] Ajax 호출시 Access-Control-Allow-Origin 크로스 도메인 문제 서버쪽 해결 방안 Access-Control-Allow-Origin 크로스 도메인 문제 서버쪽 해결 방안 web.xml // web.xml에 다음과 같이 parameterFilter를 추가한다.parameterFiltercom.test.web.filter.DefaultParameterFilter JAVA // Filter를 구현한 클래스의 doFilter함수의 ServletResponse에 다음과 같이 Header값을 설정한다.// Ajax로 호출해도 Access-Control-Allow-Origin 에러가 나지 않는다. ^^public class DefaultParameterFilter implements Filter {private FilterConfig paramFilterConfig; @Overridepublic .. 더보기
[ibatis] maxopenpreparedstatements limit reached 에러 db의 config.xml파일에 다음 항목을 확인 후 //동일한 쿼리일때 캐쉬 사용 //커넥션 당 preparedStatement 갯수 maxOpenPreparedStatements의 value값을 늘려준다. 더보기
[Tomcat] (디버그 모드시 타임아웃 에러) Server Tomcat v7.0 Server at localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor. 톰캣 서버의 타임아웃을 늘려도 에러가 난다면 브레이크 포인트를 모두 제거 후 다시 실행해보길.. 더보기
[ibatis] 동적 Column 부정확한 열 이름 에러 캐쉬로 인해 생김 remapResults="true" 속성 추가 더보기
.jar 파일 실행시 한글깨짐 maven으로 jar파일을 생성할때 소스 인코딩을 UTF-8로 지정하면 jar 파일을 실행할때도 UTF-8로 실행해야한다. jar파일 실행할때 옵션을 준다. -Dfile.encoding=UTF-8 더보기
JAVA 시간 차이 구하기 //시작 시간long start = System.currentTimeMillis(); //내용... //끝 시간long end = System.currentTimeMillis(); //시작 시간과 끝 시간의 차이long time = (long) ((end - start) / 1000.0); //결과 출력(000초)System.out.println(time + "초"); 더보기
Jcodec 이용해서 비디오파일 썸네일 만들기 Source private static void getImageFromFrame(File videoFile) {String fileName = videoFile.getAbsolutePath();String baseName = fileName.substring(fileName.lastIndexOf("\\") + 1, fileName.lastIndexOf("."));String savePath = fileName.substring(0, fileName.lastIndexOf("\\")); double frameNumber = 0d;try {SeekableByteChannel bc = NIOUtils.readableFileChannel(videoFile);MP4Demuxer dm = new MP4Demuxer(.. 더보기
maven dependency 라이브러리 추가 해서 패키징하기 pom.xml에 다음을 추가한다. org.apache.maven.pluginsmaven-dependency-plugincopy-dependenciespackagecopy-dependencies${project.build.directory}/liborg.apache.maven.pluginsmaven-jar-plugintruelib/ lib폴더에 라이브러리가 복사된다. 더보기
Seed128 문자열 암호화/복호화 SeedString Class package seed; public class SeedString extends Seed {/** * * Seed128 문자열 암호화 * * * @param plainText * @return */public byte[] encrypt(final String plainText) {byte[] byteIV = { (byte) 0x26, (byte) 0x8D, (byte) 0x66, (byte) 0xA7, (byte) 0x35, (byte) 0xA8, (byte) 0x1A, (byte) 0x81, (byte) 0x6F, (byte) 0xBA, (byte) 0xD9, (byte) 0xFA, (byte) 0x36, (byte) 0x16, (byte) 0x25, (byte) 0x0.. 더보기