XlyAiApplication.java 2.51 KB
package com.xly;

import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.HashMap;
import java.util.Map;

@EnableAsync
@EnableScheduling
@EnableCaching
@SpringBootApplication
@MapperScan("com.xly.mapper")
public class XlyAiApplication extends SpringBootServletInitializer {  // 关键:继承 SpringBootServletInitializer

    private static final Logger logger = LoggerFactory.getLogger(XlyAiApplication.class);

    @Override  // 关键:重写 configure 方法
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(XlyAiApplication.class);
    }

    /**
     * 提取报修结构化信息
     */
    @PostMapping("/")
    public String home(@RequestBody Map<String,Object> sendMap) {
       return "欢迎来到小羚羊AI系统";
    }

    public static void main(String[] args) {
        SpringApplication.run(XlyAiApplication.class, args);
        logger.info("                                              \n" +
                "                                   /$$          \n" +
                "                                  | $$          \n" +
                " /$$  /$$  /$$ /$$   /$$  /$$$$$$$| $$  /$$$$$$$\n" +
                "| $$ | $$ | $$| $$  | $$ /$$_____/| $$ /$$_____/\n" +
                "| $$ | $$ | $$| $$  | $$| $$      | $$|  $$$$$$ \n" +
                "| $$ | $$ | $$| $$  | $$| $$      | $$ \\____  $$\n" +
                "|  $$$$$/$$$$/|  $$$$$$$|  $$$$$$$| $$ /$$$$$$$/\n" +
                " \\_____/\\___/  \\____  $$ \\_______/|__/|_______/ \n" +
                "               /$$  | $$                        \n" +
                "              |  $$$$$$/                        \n" +
                "               \\______/   ");
        logger.info("I wish you a pleasant use of the system and never have any bugs");
    }
}