본문 바로가기
728x90

혼자서 개발새발55

Spring Security ) SNS 로그인 구현(내가 보려고 정리...) 내가 보려고 정리한 것 일단 시큐리티를 쓰려면 WebSecurityConfigurerAdapter 를 구현한 컨피그레이션 클래스를 만드러야한다~ 그리고 configure 오버라이딩 해준다 (configure 메소드에서 시큐리티 설정을 함) @Configuration @EnableWebSecurity // 스프링 시큐리티 필터가 스프링 필터 체인에 등록 @RequiredArgsConstructor /** * secured * preAuthorize(postAuthorize) * 메소드에 직접 권한 걸기 true */ @EnableGlobalMethodSecurity(securedEnabled = true, prePostEnabled = true) public class SecurityConfig exten.. 2023. 1. 9.
페이징 할 때 Entity로 받고, Dto로 변환하자! 저번 포스팅에서 Dto를 리포지토리에서 변환하는 것은 매우 구리다는 것을 알아냈다... 그래서 오늘은 리포지토리에서 페이징한 엔티티들을 받은 후 서비스에서 Dto로 변환하는 작업을 해봤다... 일단 전체 주문 목록을 가져오는 서비스를 만든다(엔티티를 반환하게 함) * 해당 멤버가 한 주문만 가져오는 거라서 멤버 아이디를 조건으로 주었다 public Page findAllOrders(Long memberId, Pageable pageable) { BooleanBuilder builder = new BooleanBuilder(); builder.and(mdOrder.order.member.id.eq(memberId)); return getOrderList(pageable, builder); } 그 다음 엔티.. 2023. 1. 5.
JPA ) QueryDsl , Pageble 을 이용해 페이징을 하다! 나중에 나중에 하면서 미루던 작업이 있었드.... 그것은 바로 페이징 ㅠ,ㅠ 드디어 오늘......!! 바로 이 시간....!! 나머지 파트 페이징도 끝낼 수 있었다 ㅠㅠ (어드민용은 또 새로 만들어야하긴 하지마는...) 오쨌든 ^0^ / 페이징을 구현했던 과정을 써보쟈 (간단하게 본인 1) 첫페이지를 1페이지로 만들기, 페이지 사이즈 지정 Pageble의 페이지 인덱스는 0부터 시작해서, 0 == 1페이지로 지정해주고 페이지 기본 사이즈를 정해쥰다 @Bean public PageableHandlerMethodArgumentResolverCustomizer customize() { return p -> { p.setOneIndexedParameters(true); // 1부터 시작 p.setMaxPage.. 2023. 1. 4.
게시판을 손수 페이징해보자 ^^! 머리 싸매가지고 만든 게시판 페이징~ private final int listSize = 10; private int totalPost; //총 글 갯수 private int totalPage; //총 페이지 갯수 * private int offsetPost; //페이지 첫 글 private int limitPost; //페이지 마지막 글 private int viewPage; //현재 페이지 private int beginPage; //목록 첫 페이지 private int endPage; //목록 다음 페이지 private boolean showNext = false; private boolean showPrev = false; public MarketPageHandler(int totalPost) {.. 2022. 12. 22.
저장용) JPA & QueryDsl 쓰는 법 1. build.gradle 라이브러리 추가 // hibernate 버전 오류 조절하기 ext["hibernate.version"] = "5.6.5.Final" //JPA implementation 'org.springframework.boot:spring-boot-starter-data-jpa' //Querydsl implementation 'com.querydsl:querydsl-jpa' annotationProcessor "com.querydsl:querydsl-apt:${dependencyManagement.importedProperties['querydsl.version']}:jpa" annotationProcessor "jakarta.annotation:jakarta.annotation-api.. 2022. 12. 20.
Spring) 게시판 보완(이전 글, 다음 글, 내 글에만 수정, 삭제 보이기 등) 댓글 만들기가 어려워서 헤매고 있어서 만만한 게시판을 보완해보았다 +.+ 1) 이전글, 다음글 보기 BoardController @GetMapping(/read) 에 BoardDto prevBoard = service.read(no-1); BoardDto nextBoard = service.read(no+1); m.addAttribute("prevBoard", prevBoard); m.addAttribute("nextBoard", nextBoard); 현재 글에 no-1, no+1을 해서 찾은 BoardDto, prevBoard와 nextBoard를 만들고 모델에 넣어준다 board.jsp 이전글 ${prevBoard.title} 다음글 ${nextBoard.title} 이전글과 다음글 테이블을 만들고 .. 2022. 11. 23.
728x90