package com.zhentao;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication(exclude = {
    org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration.class
})
@ComponentScan(basePackages = {
    "com.zhentao.config",
    "com.zhentao.controller",
    "com.zhentao.service",
    "com.zhentao.handler",
    "com.zhentao.utils"
})
@MapperScan({"com.zhentao.repository", "com.zhentao.mapper"})
public class WebSocketApplication {
    public static void main(String[] args) {
        org.springframework.context.ConfigurableApplicationContext context = SpringApplication.run(WebSocketApplication.class, args);
        System.out.println("WebSocket聊天服务启动成功！");
        System.out.println("WebSocket连接地址: ws://localhost:1004/ws/chat?userId={userId}");
        
        System.out.println("====== 检查 Bean 是否存在 ======");
        boolean hasChatController = context.containsBean("chatController");
        System.out.println("ChatController 存在: " + hasChatController);
        
        if (hasChatController) {
            System.out.println("ChatController Bean: " + context.getBean("chatController"));
        } else {
            System.err.println("❌ 严重错误: ChatController 未被注册！请检查包扫描路径或编译输出。");
        }
        System.out.println("==============================");
    }
}
