|
|
|
@ -0,0 +1,36 @@
|
|
|
|
|
package com;
|
|
|
|
|
|
|
|
|
|
// 导入MyBatis的Mapper扫描注解
|
|
|
|
|
import org.mybatis.spring.annotation.MapperScan;
|
|
|
|
|
// 导入Spring Boot核心启动类
|
|
|
|
|
import org.springframework.boot.SpringApplication;
|
|
|
|
|
// 导入Spring Boot自动配置注解
|
|
|
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
|
|
|
// 导入Spring应用构建器
|
|
|
|
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
|
|
|
|
// 导入Servlet组件扫描注解
|
|
|
|
|
import org.springframework.boot.web.servlet.ServletComponentScan;
|
|
|
|
|
// 导入Spring Boot Servlet初始化器
|
|
|
|
|
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
|
|
|
|
|
|
|
|
|
// 主应用类,使用SpringBootApplication注解标识为Spring Boot应用
|
|
|
|
|
@SpringBootApplication
|
|
|
|
|
// 扫描指定包下的Servlet组件
|
|
|
|
|
@ServletComponentScan(value = "com.ServletContextListener")
|
|
|
|
|
// 扫描指定包下的MyBatis Mapper接口
|
|
|
|
|
@MapperScan(basePackages = {"com.dao"})
|
|
|
|
|
public class jianshenfangglApplication extends SpringBootServletInitializer {
|
|
|
|
|
|
|
|
|
|
// 应用主入口方法
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
// 启动Spring Boot应用
|
|
|
|
|
SpringApplication.run(jianshenfangglApplication.class, args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 重写configure方法用于外部容器部署
|
|
|
|
|
@Override
|
|
|
|
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder applicationBuilder) {
|
|
|
|
|
// 配置应用源
|
|
|
|
|
return applicationBuilder.sources(jianshenfangglApplication.class);
|
|
|
|
|
}
|
|
|
|
|
}
|