Skip to content

Commit

Permalink
[#286] feat(JpaAuditingConfig): JPAQueryFactory 구성
Browse files Browse the repository at this point in the history
- JPA 환경을 구성하고 QueryDSL을 사용할 수 있도록 설정하는 클래스
- 매번 EntityManager를 주입받아서 구성해야 하는 JPAQueryFactory를 bean으로 등록하여 간편하게 사용하기 위한 목적으로 구성
  • Loading branch information
hoonyworld committed Dec 5, 2024
1 parent 1d6e0c0 commit 6e9ac0d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/main/java/com/beat/global/common/config/JpaAuditingConfig.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
package com.beat.global.common.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;

import com.querydsl.jpa.impl.JPAQueryFactory;

import jakarta.persistence.EntityManager;
import jakarta.persistence.PersistenceContext;

@Configuration
@EnableJpaAuditing
public class JpaAuditingConfig {

@PersistenceContext
private EntityManager em;

@Bean
public JPAQueryFactory jpaQueryFactory() {
return new JPAQueryFactory(em);
}
}

0 comments on commit 6e9ac0d

Please sign in to comment.