File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
src/main/java/com/example/log4u/common/config Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 1+ package com .example .log4u .common .config ;
2+
3+ import org .springframework .context .annotation .Bean ;
4+ import org .springframework .context .annotation .Configuration ;
5+ import org .springframework .context .annotation .Profile ;
6+
7+ import com .querydsl .jpa .impl .JPAQueryFactory ;
8+
9+ import jakarta .persistence .EntityManager ;
10+ import jakarta .persistence .PersistenceContext ;
11+
12+ @ Configuration
13+ public class PostgresQuerydslConfig {
14+
15+ @ PersistenceContext (unitName = "postgresqlEntityManagerFactory" )
16+ private EntityManager postgresEntityManager ;
17+
18+ @ Bean (name = "postgresJPAQueryFactory" )
19+ public JPAQueryFactory postgresJPAQueryFactory () {
20+ return new JPAQueryFactory (postgresEntityManager );
21+ }
22+ }
Original file line number Diff line number Diff line change 22
33import org .springframework .context .annotation .Bean ;
44import org .springframework .context .annotation .Configuration ;
5+ import org .springframework .context .annotation .Primary ;
56
67import com .querydsl .jpa .impl .JPAQueryFactory ;
78
@@ -17,6 +18,7 @@ public QueryDslConfig(EntityManager entityManager) {
1718 }
1819
1920 @ Bean
21+ @ Primary
2022 public JPAQueryFactory jpaQueryFactory () {
2123 return new JPAQueryFactory (entityManager );
2224 }
You can’t perform that action at this time.
0 commit comments