2024/10/08(3)
-
파일 업로드
파일업로드multipart/form-data 방식으로 전송spring boot의 경우 application.properties의 설정으로 파일 관련 설정을 할 수 있다 Application.properties[application.properties]// File Upload SIZE 설정spring.servlet.multipart.max-file-size = 1MBspring.servlet.multipart.max-request-size = 10MB// File multipart On/Offspring.servlet.multipart.enable=true/false ( default : true )// 파일 업로드 경로 (슬래시("/") 주의)file.dir = /Users/Test/study/dire..
2024.10.08 -
Formatter (포맷터)
Formatter... Formatter 란?Converter의 심화 버전Converter의 경우 제한이 없는 변환이 가능 (ex 문자 객체 , 숫자 객체 등등..)Formatter의 경우 문자를 기준으로 변경하는 것을 의미 ( 문자 객체 , 문자 숫자 , 문자를 기준으로 변경) Formatter 인터페이스public interface Formatter extends Printer, Parser {}public interface Printer { String print(T object, Locale locale);}public interface Parser { T parse(String text, Locale locale) throws ParseException;} Formatter ..
2024.10.08 -
Spring Type Converter (타입 형변환)
spring type converter.. 타입 변환 필요 예시스프링 MVC 요청 파라미터@RequestParam@ModelAttribute@PathVariable@Value 등으로 YML 정보 읽기XML에 넣은 스프링 빈 정보 변환View를 렌더링할 때 Converter Interfacepublic interface Converter { @Nullable T convert(S source);}S -> T 로 변환원하는 타입에 맞추어서 변환 가능// Member.class@Getter@AllArgsConstructorpublic class Member{ private String memberName; private Integer memberNum;}// StringToMemberCo..
2024.10.08