SpringBoot Controller找不到视图路径

来源:互联网 发布:mac pro 必备软件 编辑:程序博客网 时间:2024/05/21 10:31

由于版本差异,用SpringBoot 1.4.X以上版本开发时找不到@Controller定义的URL,于是在启动类加注解@ComponentScan("com.controller")即可,括号里表示Controller所在包名。

@SpringBootApplication
@ComponentScan("com.controller")
public class Application {


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

0 1
原创粉丝点击