본문 바로가기

Spring

Spring MimeMessageHelper attachment filename encoding System.setProperty("mail.mime.splitlongparameters", "false"); MimeMessage message = sender.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(message, true, "UTF-8"); // Your email content helper.setFrom("..."); helper.setTo("..."); helper.setSubject("..."); helper.setText("..."); helper.addAttachment( MimeUtility.encodeWord(attachmentFilename), attachmentConten 더보기
SPRING BOOT COMMUNICATIONS LINK FAILURE WITH MYSQL AND HIBERNATE http://blog.netgloo.com/2015/07/09/spring-boot-communications-link-failure-with-mysql-and-hibernate/ 더보기
[Spring Framework] Injection of autowired dependencies failed 아래의 에러에서 주목해야되는 부분은 circular reference 이다. 즉... @Inject 애노테이션을 쓰면서 서로 서로 가지도록 설정을 해서 발생한 문제이다. 해결 방법은구조적으로 @Inject 하는 상황을 회피하도록 만들거나... http://java.dzone.com/articles/resolve-circular-dependency 여기를 참고해서 보자~! org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'userService': Bean with name 'userService' has been injected into other beans [matchingSer.. 더보기
[Android] Spring 라이브러리로 Multipart-form data 전송하기~! 1. 준비물~! (아래의 라이브러리를 받거나 메이븐으로 직접받아도된다.~! 본인의 경우 메이븐 연동에서 잘되지 않아서 직접 추가함) 2. 소스코드 아래와 같이 코드를 넣어서 작동시키면 된다.~! (주의 : Network이므로 AsyncTasker를 이용하거나 UIThread에서 실행하지만 않으면됨 그리고 Method는 POST만 가능한듯... PUT은 정확한 이유는 모르지만 서버와 통신을 실패함) HttpHeaders multipartHeaders = new HttpHeaders();multipartHeaders.setContentType(MediaType.MULTIPART_FORM_DATA); final MultiValueMap value = new LinkedMultiValueMap();value.a.. 더보기
[Hibernate] Many To One 1. 객체를 가지고 있어야할 모델에 객체를 넣는다 (해당 예제의 경우 SomeThing이 Action을 가지고 있음)public class SomeThing { private Action lastAction; } 2. Xml 추 가 3. DB변경 last_action 이라는 int값을 Column 값을 넣어준다. 4. 적용완료~! 더보기
[Spring Framework] RestTemplate 사용시 Caused by: java.io.EOFException 에러... 안드로이드에서 Spring Framework 의 RestTemplate을 사용하면서 종종Caused by: java.io.EOFException at libcore.io.Streams.readAsciiLine(Streams.java:203) at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:560) at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:813) at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:274) at libcore.net.http.HttpURLConnectionImp.. 더보기
[Spring Framework] MongoDB연동하기~! 자세한 사항은 여기를 참고하세요~! 1. 라이브러리 추가~! org.mongodbmongo-java-driver2.11.0 org.springframework.dataspring-data-mongodb 1.2.0.RELEASE 2. 설정파일 설정 3. 모델 만들기 import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.Document; @Document(collection = "users") public class User { @Id private String id; String username; String password; //getter, setter, toString, Con.. 더보기
[Spring Framework] Element <ehcache> does not allow attribute "xmlns:xsi" Spring Framework에서 Ehcache를 연동할때 아래와 같은 오류가 보인다면... 본인의 경우 Maven에서 라이브러리가 제대로 인식되지 않아서 생긴 오류였다. Maven을 다시 한번 잘볼것 ~! 더보기
[Spring Framework] Ehcache 사용하기 1. 라이브러리 세팅~! org.springframework spring-context-support ${org.springframework-version} com.googlecode.ehcache-spring-annotationsehcache-spring-annotations1.1.3net.sf.ehcacheehcache2.7.4 2. 설정파일 작성 3. 캐쉬설정파일 작성 (ehcache.xml 파일이며 스프링 프로젝트에서 resource에 위치함) 4. 캐쉬 사용하기 cacheable 애노테이션과 캐쉬설정파일에서 작성한 testCache1 를사용한다. @Cacheable(cacheName="testCache1")@Override public List getMonthMenu (final int year.. 더보기
[Spring Framework] Spring + Vert.x 연동하기~! 우선 pom.xml에서 vert.x의 라이브러리를 추가하자~!platform은 필요없다고 했지만... 그냥 추가해봤다.. 그리고 임의로 Vert.x 예제를 만든다. 스프링이기 때문에 Verticle를 상속받지않고new로 해서 사용했다 쫌더 연구 필요~! 그리고 방금내가 만든 클래스를 bean으로 등록~! 그리고 이건 예제 View~! 당연히 Controller에서 socket.jsp를 볼수 있도록 만들어준다. 그리고 실행~!내가 원하는 예제가 나왔다~! 더보기