SpringBoot启动类模板

package com.xuecheng.manage_cms;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.ComponentScan;

/**
 * @author Huang
 * @version 1.0
 * @date 2020/3/18 15:10
 */
@SpringBootApplication
//如果不添加额外的扫描注解, 则本启动类只会扫描到该本包下的文件, 不会扫到引入项目的文件
@EntityScan("com.xuecheng.framework.domain.cms")//扫描实体类(扫描带有@Entity的实体类)
@ComponentScan(basePackages={"com.xuecheng.api"})//扫描接口(扫描带有@Component以及子注解的类)
@ComponentScan(basePackages={"com.xuecheng.framework"})//扫描common包(扫描带有@Component以及子注解的类)
@ComponentScan(basePackages={"com.xuecheng.manage_cms"})//扫描本项目下的所有类(不添加也可以)
public class ManageCmsApplication {
    public static void main(String[] args) {
        SpringApplication.run(ManageCmsApplication.class, args);
    }
}

发布了86 篇原创文章 · 获赞 1 · 访问量 4340

猜你喜欢

转载自blog.csdn.net/qq_42039738/article/details/105158375
今日推荐