728x90 전체 글520 spring security 세션 package io.security.basicsecurity; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configura.. 2021. 12. 1. spring security Remember Me 인증 package io.security.basicsecurity; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configura.. 2021. 11. 30. spring security logout package io.security.basicsecurity; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.s.. 2021. 11. 30. spring security Form Login 2021. 11. 29. spring security 기본설정 @EnableWebSecurity, WebSecurityConfigurerAdapter 등록 필수!! package io.security.basicsecurity; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.W.. 2021. 11. 29. Vue Eslint error 해결 프로젝트 최상위 경로에 적어준다 (vue.config.js) 2021. 11. 24. 카카오 로그인, 로그아웃 Kakao Login Kakao Logout 2021. 11. 18. git 명령어 커밋 한 것만 되돌림 (Staging Area, Repsitory 그대로) git reset --soft HEAD^ add 한 것까지 되돌림 (Staging Area, Repsitory 되돌림, Working Directory는 그대로) git reset --mixed HEAD^ 수정한 것까지 통째로 되돌림(가장 최근 커밋 하나 전으로 되돌림) (Working Directory, Staging Area Repository 되돌림) git reset --hard HEAD^ 가장 최근 커밋으로부터 두 개 전으로 되돌려라 git reset --hard HEAD^^ 용어 HEAD : 가장최근 버전에서(현재 작업중인 브랜치/ 커밋 중 가장 최근 커밋을 가리킨다) ^ : 하나 되돌리자 깃 브랜치 확인 git bra.. 2021. 11. 17. Prettier tab(공백) 에러 80으로 변경 2021. 11. 16. Vue.devtools 미작동 (vue cli 4.x) VUE2 CLI 설치순서 방법으로 해보니 정상적으로 Vue.js Devtools이 정상적으로 실행되네요..^^ 1. npm i -g @vue/cli-init 2. vue.cmd init webpack-simple vue-todo 3. cd vue-todo 4. npm install 5. npm run dev 2. Devtools Settings 확장 프로그램 상세설정으로 들어가서 파일 URL에 대한 액세스 허용이 필요함 확장프로그램 상세 설정 창 Vue.js devtools 상세설정 출처: https://kkamikoon.tistory.com/entry/Vuejs-Vue-devtools-확장탭Vue-Panel-안-보일-때 [컴퓨터를 다루다] 출처: https://kkamikoon.tistory.com/e.. 2021. 11. 10. .vue 파일 html 태그 자동완성 안될때 seetings.json 마지막에 추가 https://sbarrys.tistory.com/166 2021. 11. 10. Vue.js event, emit 예제 당신이 좋아하는 파트를 선택하세요 총 투표수 : {{ total }} 2021. 11. 8. 스프링 AOP 포인트 컷 외부 설정 pointcut 모아놓은 클래스 외부에서 접근 가능하게 public 설정 package hello.aop.order.aop; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Pointcut; public class Pointcuts { // hello.aop.order 패키지와 하위패키지 @Pointcut("execution(* hello.aop.order..*(..))") public void allOrder(){} //pointcu signature // 클래스 이름 패턴이 *Service @Pointcut("execution(* *..*Service.*(..))") public void allService().. 2021. 11. 3. 스프링 AOP 순서 설정 클래스마다 순서 설정 가능 내부클래스로 관리 package hello.aop.order.aop; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.springframework.core.annotation.Order; @Slf4j public class AspectV5 { @Aspect @Order(2) public static class LogAspect{ @Around("hello.aop.order.aop.Pointcuts.allOrder().. 2021. 11. 3. 스프링 Swagger 설치 package com.danal.snack.swagger; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.validation.Errors; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotat.. 2021. 10. 29. 스프링 mybatis 설정 1. 메이븐 설치(root-context.xml) 버전에 맞는 mybats, spring-mybatis 설치 3. SqlSession,SqlSessionFactoryBean 빈등록 (mappers 경로 설정) typeAliasesPackage 설정은 해당 패키지 경로 풀로 작성하지 않고 dto 사용 가능 xml 빈등록 방식을 java config로 변경 package com.jurib.movie.config; import javax.sql.DataSource; import org.apache.commons.dbcp.BasicDataSource; import org.apache.ibatis.session.SqlSessionFactory; import org.mybatis.spring.SqlSessionFa.. 2021. 10. 27. 스프링 h2 설정 및 jpa 설정 (application.yml) spring: datasource: #jdbc url url: jdbc:h2:tcp://localhost/~/querydsl username: sa password: driver-class-name: org.h2.Driver jpa: hibernate: ddl-auto: create properties: hibernate: # show_sql: true format_sql: true logging.level: org.hibernate.SQL: debug # org.hibernate.type: trace jdbc url 2021. 10. 24. H2 DB 파일생성 후 네트워크 접속 오늘은 H2 DB를 파일모드로 사용하는 방법에 대해서 알아보겠습니다. H2 DB는 파일모드로 사용할 수도 있고, 메모리 모드로 사용할 수 도 있습니다. 메모리 모드로 할 경우에는 테스트에서 사용하기가 좋습니다. 스프링부트에서 별도 설치없이 의존성만 추가하면 바로 사용할 수 있고, 메모리에서 실행되기 때문에 프로그램이 시작될 때 데이터가 모두 초기화 됩니다. 파일모드로 하려면 H2 DB를 다운받고 실행해주는 과정이 필요합니다. H2 DB 다운로드 받기 먼저 H2 DB 홈페이지 (https://www.h2database.com/html/main.html) 에 방문해서 파일을 다운로드 받아야 합니다. 'Download' 메뉴로 들어가서 '1.4.199 - Last Stable' 버전을 다운로드 합니다. (다운.. 2021. 10. 24. 스프링 Querydsl 설치 build.gradle Querydsl 설정 추가 plugins { id 'org.springframework.boot' version '2.4.12' id 'io.spring.dependency-management' version '1.0.11.RELEASE' //querydsl 추가 id "com.ewerk.gradle.plugins.querydsl" version "1.0.10" id 'java' } group = 'study' version = '0.0.1-SNAPSHOT' sourceCompatibility = '11' configurations { compileOnly { extendsFrom annotationProcessor } } repositories { mavenCentral() } .. 2021. 10. 24. 스프링 데이터 jpa 사용자 정의 ID를 사용하는경우 @GeneratedValue 를 사용하지 않는경우 사용자 정의 id를 사용하는경우 스프링데이터 jpa에서는 save() 작업을 하는경우 merge가 발생하므로 따로 설정해줘야한다. Persisteable 인터페이스를 구현해야한다. package com.study.datajpa.entity; import lombok.AccessLevel; import lombok.NoArgsConstructor; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.domain.Persistable; import org.springframework.data.jpa.domain.support.AuditingEntityLi.. 2021. 10. 24. 스프링 데이터 jpa Auditing BaseEntity 생성 package com.study.datajpa.entity; import lombok.Getter; import org.springframework.data.annotation.CreatedBy; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedBy; import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener; import javax.persistenc.. 2021. 10. 23. 스프링 데이터 jpa 사용자 정의 repository 구현 사용자 정의 인터페이스 구현 package com.study.datajpa.repository; import com.study.datajpa.entity.Member; import java.util.List; public interface MemberRepositoryCustom { List findMemberCustom(); } 사용자 정의 인터페이스 구현체 상속해줄려는 스프링 데이터 jpa 인터페이스명 + "Impl", 부모 인터페이스 명은 상관없음, 구현체명이 중요! package com.study.datajpa.repository; import com.study.datajpa.entity.Member; import lombok.RequiredArgsConstructor; import javax.p.. 2021. 10. 23. 스프링 데이터 jpa 패치조인 @EntityGraph 인터페이스 XToOne 연관관계 일때 FetchType.Lazy 설정으로 바꾸고 스프링 데이터 jpa에서 패치조인 @Query("select m from Member m left join fetch m.team") List findMemberFetchJoin(); @Override @EntityGraph(attributePaths = {"team"}) List findAll(); // jpql에 적용 @EntityGraph(attributePaths = {"team"}) @Query("select m from Member m") List findMemberEntityGraph(); @EntityGraph(attributePaths = ("team")) List findEntityGraphByUsernam.. 2021. 10. 23. 스프링 데이터 jpa 벌크 쿼리 인터페이스 package com.study.datajpa.repository; import com.study.datajpa.dto.MemberDto; import com.study.datajpa.entity.Member; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Slice; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.spr.. 2021. 10. 23. 스프링 data jpa 페이징 인터페이스 구현 import com.study.datajpa.dto.MemberDto; import com.study.datajpa.entity.Member; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Slice; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Para.. 2021. 10. 23. 스프링 데이터 JPA 복잡한 정적 쿼리 @Query @Query 어노테이션 사용 장점 : 컴파일시 문법오류 체크 package com.study.datajpa.repository; import com.study.datajpa.entity.Member; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import java.util.List; public interface MemberRepository extends JpaRepository { List findByUsername(String userna.. 2021. 10. 22. 스프링 데이터 JPA 기초 레포지토리 인터페이스 생성 후 JpaRepository 상속 package com.study.datajpa.repository; import com.study.datajpa.entity.Member; import org.springframework.data.jpa.repository.JpaRepository; public interface MemberRepository extends JpaRepository { } 테스트 스프링 데이터 JPA 리턴시 결과는 Optional로 준다. package com.study.datajpa.repository; import com.study.datajpa.entity.Member; import org.junit.jupiter.api.Test; import org.sp.. 2021. 10. 22. 스프링 에러 java.lang.ClassNotFoundException 스프링 에러java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener 컴퓨터 사용계정을 몇일전에 기본으로 변경했어요. 그랬더니 프로젝트 실행할려니 여러문제를 겪게 되었는데요. 기존 작성한 프로젝트를 열었어요. 메이븐을 업데이트 했어요. Maven -> Update Project 프로젝트를 실행하니 에러가 발생합니다. java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener 구글검색을 하니까 문제 해결법이 나왔어요. Deployment Assembly 프로젝트 설정에서 Deployment Assembly에 Ma.. 2021. 10. 21. JPA 조인 패치조인 // 컨트롤러 @GetMapping("/api/v3/simple-orders") public List ordersV3(){ List orders = orderRepository.findAllWithMemberDelivery(); List result = orders.stream() .map(o -> new SimpleOrderDto(o)) .collect(Collectors.toList()); return result; } // DB 패치조인 조회 public List findAllWithMemberDelivery() { return em.createQuery( "select o from Order o" + " join fetch o.member m" + " join fetch o.deliver.. 2021. 10. 19. Rest API 개발시 양뱡향 연관관계 주의할 점 1. 양뱡향 연관관계인 경우 조회 데이터를 다시 호출하는 객체에 @JsonIgnore 어노테이션을 붙여준다. 2. hibernate5Module 설치후 빈 등록 //그래들 설치 implementation 'com.fasterxml.jackson.datatype:jackson-datatype-hibernate5' @Bean Hibernate5Module hibernate5Module(){ return new Hibernate5Module(); } 2021. 10. 18. 이전 1 ··· 8 9 10 11 12 13 14 ··· 18 다음 728x90