package com.malk.apigw;

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 org.springframework.scheduling.annotation.EnableScheduling;

import javax.persistence.EntityManager;

/**
 * mjava-com 启动类（API Gateway）
 *
 * <p>把 mjava 基座 Client 能力以 REST 网关形式对外开放。外部系统通过 apiKey + HMAC 签名调用。</p>
 *
 * <p>package 命名 com.malk.apigw（避免 com.malk.com 的可读性问题，模块名仍为 mjava-com）。</p>
 */
@EnableJpaAuditing
@EnableScheduling
@SpringBootApplication(scanBasePackages = {"com.malk"})
public class Boot {

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

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