전체 글

1. Get요청 url의 parameter 형태로 ?key=value&key=value&... 형태로 데이터를 담아서 보냄 body로 데이터를 담아 보내지 않고 url에 담음 2. Post, Put, delete 요청 (데이터를 변경) 데이터를 담아서 보내야할 것이 많음 그래서 body에 담아서 보냄 여러가지 data MIME형식 중 form태그는 Get, Post방식 2가지 방식으로 밖에 보낼 수 없음 (key=value) 그래서 통일 : 자바스크립트로 ajax요청 + 데이터는 json으로 통일!! form:form 태그라는 것도 있는데 (4가지 다 쓸 수 있음)(X) 안씀 자바스크립트로 ajax요청 + 데이터는 json으로 통일
· Debug
삭제하기 기능은 @PostMapping이 아니라 @DeleteMapping을 애노테이션으로 붙여주어야 한다 @PostMapping붙여서 오류남
· Debug
[에러 현상] insert작업을 할 때 RequestBody의 데이터 MIME타입을 x-www-form-rulencoded로 했을 때는 문제가 없는데 raw(Json)의 형태로 하면 propertyValueException이 일어남 [에러 후보] Json데이터의 형식을 실수함 [에러 원인] Join메서드의 DTO인 User 패러미터 앞에 @RequestBody를 붙여주지 않아서 에러가 났던 것임.. 근데 @RequestBody붙이니까 이젠 xxx-form-urlencoded방식으로 하니까 지원안한다는 식으로 뜸​ @ResponseBody를 붙이지 않으면 자동으로 @ModelAttribute가 붙는다고 한다.. 이 둘의 차이 때문에 Json은 @ResponseBody을 붙이고 xxx-form-urlenco..
public class StringReverse { public static void main(String[] args) { // 문자열 String str = "ABCDE"; // 문자열 reverse StringBuffer sb = new StringBuffer(str); String reverse = sb.reverse().toString(); // 결과 출력 System.out.println(sb); // "EDCBA" System.out.println(reverse); // "EDCBA" } } String클래스한테 그런건 없다^^는 가지고 있지 않고 StringBuilder/StringBuffer가 가지고 있다. String str = StringBuilder.reverse().toString..
Arrays.stream( char[] )를 했는데 오류가 났음.. 이게 Array.stream()안의 parameter type은 static DoubleStreamstream​(double[] array) Returns a sequential DoubleStream with the specified array as its source. static DoubleStreamstream​(double[] array, int startInclusive, int endExclusive) Returns a sequential DoubleStream with the specified range of the specified array as its source. static IntStreamstream​(int[]..
소켓은 연결을 유지해야해서 비효율적이에요.. 계속 커넥션을 물고 있는 것이 효율적인가..? 사이트에 남아 있는 것에 비해 클릭수가 적으면 소켓이 더 비효율적이다. 소켓이 유리해지는 초당 통신량을 비교해보고 http통신vs소켓통신 골라야하는듯 1. http 통신도 내려가면 극일부예외를 제외하고는 소켓으로 구현되어 있습니다 2. http가 stateless다보니 연결을 유지하지 않아서 비효율적이라 http keep-alive 등의 옵션으로 세션 유지하는 방법을 사용합니다. 3. http 통신을 하는건 어플리케이션단의 프로토콜 통일을 위해서 주로 사용합니다 아모튼 소켓이 연결을 유지해야해서 비효율적인 것은 아닙니닷 Connection을 만들고 끊는 작업이 비효율적임 -> keep-alive옵션으로 … 그리고 ..
결론 : data가 반환되어야 하면 RestController와 함께 RequestBody를 사용하고, view가 반환되어야 하면 Controller를 사용하는 것으로 보입니다. @Transactional 어노테이션을 사용하면, userRepository.save(user);(save메소드)를 쓰지 않더라도 값을 변경하면 데이터가 update된다. 이것을 '더티체킹'이라 한다. 더티체킹의 근본 의미는 상태변화 검사이다 // save메소드는 2가지 일을 한다. 객체에 id가 담겨있지 않으면 insert의 일을 하고 // 객체에 id가 담겨 있으면 해당 id에 대한 update의 일을 해주고 // 객체에 id가 담겨 있는데 해당 id에 대한 레코드가 존재하지 않으면 insert의 일을 한다 답변 첫 번째 경..
· Debug
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL " alter table Reply add constraint FKr5xsgtav636xcqpjh0j81wb2n foreign key ('boardId') references Board (id)" via JDBC Statement Caused by: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''userId') r..
· Debug
2022-03-04 18:49:24.636 ERROR 19788 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Failed to initialize JPA EntityManagerFactory: Unsupported property type [java.security.Timestamp] for @CreationTimestamp or @UpdateTimestamp generator annotation 2022-03-04 18:49:24.637 WARN 19788 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context..
· Debug
안되는 이유 후보들 - com.cos. 이하의 컴포넌트 스캔이 안되는 패키지로 만들었다 - project rebuild를 해줘야 하는데 안했다 이것저것 눌러보다가.. 프로젝트 컴파일한다음에 제대로 성공한 후에 다시 @Entity해보니까 성공함 그럼 도대체 왜 처음에는 되지 않았던 것일까..? 그냥 넘어가기에는 너무 짜증났음 별 것도 아닌 주제에 왜 막혔는지 알고 싶었다 org.springframework.boot spring-boot-starter-data-jpa pom.xml의 위 jpa 관련 dependency를 다시 주석처리함 -> 그 후에 boot application실행 -> 다시 @Entity써봄 -> 첫번째 사진처럼 @Entity 안읽힘 결론 : pom.xml에 depency 수정 후 바로 ..
배게
백엔드