-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[refactor] JPAQueryFactory를 BeanContainer로 생성 후 관리하도록 변경
- 기존 로직은 메서드에서 매번 팩토리를 생성 - 매번 메서드마다 팩토리를 생성하는 코드 중복이 일어남 - 팩토리를 매번 생성하면 성능적인 오버헤드가 생김 - 팩토리는 Thread-Safe한 객체기 때문에 싱글톤으로 관리되어도 아무런 문제가 없다.
- Loading branch information
Showing
2 changed files
with
20 additions
and
3 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
src/main/java/camp/woowak/lab/web/config/QuerydslConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package camp.woowak.lab.web.config; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
|
||
import jakarta.persistence.EntityManager; | ||
|
||
@Configuration | ||
public class QuerydslConfig { | ||
@Bean | ||
public JPAQueryFactory jpaQueryFactory(EntityManager entityManager) { | ||
return new JPAQueryFactory(entityManager); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters