package com.malk.benteler;

import com.querydsl.jpa.impl.JPAQueryFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;

import javax.persistence.EntityManager;

/**
 * 本特勒客户子项目启动类。
 */
@EnableJpaAuditing
@SpringBootApplication(scanBasePackages = {"com.malk"})
public class Boot {

    public static void main(String... args) {
        SpringApplication.run(Boot.class, args);
    }

    /**
     * 注册 QueryDSL 查询工厂。
     *
     * @param entityManager JPA EntityManager
     * @return QueryDSL 查询工厂
     */
    @Bean
    public JPAQueryFactory jpaQueryFactory(EntityManager entityManager) {
        return new JPAQueryFactory(entityManager);
    }
}
