전체 글(68)
-
JAVA Enum Value로 Key 찾아오기
public enum GubunCode { GUBUN1("GUBUN1_value11", "GUBUN1_value12", "GUBUN1_value13"), GUBUN2("GUBUN1_value21", "GUBUN1_value22", "GUBUN1_value23"); private final String displayValue1; private final String displayValue2; private final String displayValue3; private GubunCode(String displayValue1, String displayValue2, String displayValue3){ this.displayValue1 = displayValue1; this.displayValue2 = ..
2023.07.06 -
Spring Boot Controller 에서 전체 파라메터 폼 클래스 유효성 검증
컨트롤러에 WebDataBinder을 이용하여 파라메터로 넘어오는 폼 클래스의 유효성검증을 추가 private final BoradFormValidator boardFormValidator; @InitBinder("boardForm") public void initBinder(WebDataBinder webDataBinder) { webDataBinder.addValidators(boardFormValidator); } 해당 컨트롤러 상단에 선언을 해줍니다. @InitBinder("boardForm") 에서 boardForm의 이름으로 클래스를 찾아서 검증 @GetMapping("/boardDetail") public String detail(Model model, BoardForm boardForm) ..
2023.07.05 -
Spring Boot Validated 유효성 검증 그룹 설정
public class ValidationGroups { public interface OnUpdate {} public interface OnInsert {} } ValidationGroups 클래스에 해당 interface를 선언 해두고 @Data public class BoardForm { @NotBlank(message = "제목은 필수입니다.", groups = {ValidationGroups.OnInsert.class}) @Length(min = 5, message = "제목은 6글자 이상", groups = {ValidationGroups.OnInsert.class}) @Length(max = 15, message = "제목은 15글자 이하", groups = {ValidationGroups..
2023.07.04 -
Spring Boot 정적 리소스 설정
spring: web: resources: static-locations: classpath:/js, classpath:/css, classpath:/static application.yml에 다음과 같이 경로들을 나열하면 해당프로젝트의 폴더 위치로 접근이 가능하다.
2023.07.04 -
좌표 기반 폴리곤 안에 위치해 있는지 확인하는 자바스크립트
function pointInPolygon(point, polygon) { var x = point[0], y = point[1]; var inside = false; for (var i = 0, j = polygon.length - 1; i y) != (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi); if (intersect) inside = !inside; } return inside; } var po..
2023.07.03 -
MSSQL CPU 점유 성능 향상
DB 서버의 CPU가 100프로를 찍을 때가 있어서 찾아보았다. SQL SERVER 에서 최대 병렬 처리 관련해서 처리할수있다. max degree of parallelism 옵션(MAXDOP) 을 쿼리에 적용 할 수 있고 데이터베이스에 옵션 설정을 할 수 있다. USE AdventureWorks2012 ; GO EXEC sp_configure 'show advanced options', 1; GO RECONFIGURE WITH OVERRIDE; GO EXEC sp_configure 'max degree of parallelism', 16; GO RECONFIGURE WITH OVERRIDE; GO 위의 SQL은 데이터베이스 옵션을 변경 설정 하는것이다. 쿼리에서 옵션을 설정 할수도 있다. USE Adv..
2023.07.03