JAVA/spring

    Runner 구현

    package com.today10sec.diary.etc; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax...

    [1028 from 스프링 백기선 JPA] 스프링데이터 Common _ 쿼리, 비동기, 도메인, QueryDSL (추후 추가. )

    쿼리 만들기 스프링 데이터 저장소의 메소드 이름으로 쿼리 만드는 방법 메소드 이름을 분석해서 쿼리 만들기 (CREATE) 미리 정의해 둔 쿼리 찾아 사용하기 (USE_DECLARED_QUERY) 미리 정의한 쿼리 찾아보고 없으면 만들기 (CREATE_IF_NOT_FOUND) >> 기본값 @SpringBootApplication //@EnableJpaRepositories(queryLookupStrategy = QueryLookupStrategy.Key.CREATE) @EnableJpaRepositories(queryLookupStrategy = QueryLookupStrategy.Key.CREATE_IF_NOT_FOUND) //@EnableJpaRepositories(queryLookupStrategy ..

    [1028 from 스프링 백기선 JPA] 스프링데이터 Common _ Repository, Interface, null

    스프링 데이터 Common Repository CrudRepository PagingAndSortingRepository 스프링 데이터 JPA JpaRepository -> PagingAndSortingRepository, QueryByExampleExecutor CrudRepository PagingAndSortingRepository -> CrudRepository S save(S var1); Iterable saveAll(Iterable var1); Optional findById(ID var1); boolean existsById(ID var1); Iterable findAll(); Iterable findAllById(Iterable var1); long count(); void deleteBy..

    [1028 from 스프링 백기선 JPA] 스프링데이터 _ JPA 원리, 스프링데이터 모듈

    JpaRepository JpaRepository 인터페이스 매직인터페이스 @Repository가 없어도 빈으로 등록해 줌 public interface DiaryRepository extends JpaRepository { } @EnableJpaRepositories (스프링부트에서 지원, 생략) 컨피규레이션 위에 올림. 스프링부트 시작은 @Import(JpaRepositoriesRegistrar.class) 핵심은 ImportBeanDefinitionRegistrar 인터페이스 : 스프링프레임워크 : 빈을 프로그래밍을 통해 등록가능. public class DiaryRegistrar implements ImportBeanDefinitionRegistrar { @Override public void r..

    반응형