zoukankan      html  css  js  c++  java
  • spring boot包扫描不到controller层

    启动类代码

    package com.maven.demo;
    
    import org.mybatis.spring.annotation.MapperScan;
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    import org.springframework.context.annotation.ComponentScan;
    import org.springframework.transaction.annotation.EnableTransactionManagement;
    
    @SpringBootApplication
    @EnableAutoConfiguration
    @ComponentScan("com.maven.demo")
    @MapperScan("com.maven.demo")
    @EnableTransactionManagement
    public class DemoApplication {
    
        public static void main(String[] args) {
            SpringApplication.run(DemoApplication.class, args);
        }
    }

    发现路径都是对的,但是就是扫描不到controller层

    原因是maven多模块项目忘记引入子模块的maven依赖了,启动类是一个子模块,controller的代码是另外一个子模块,低级错误。

  • 相关阅读:
    bzoj3272 Zgg吃东西
    bzoj3894 文理分科
    poj1149 PIGS
    poj1637 Sightseeing tour
    [Wc2007]剪刀石头布
    poj2396 Budget
    [NOI2017]游戏
    CF666E Forensic Examination
    bzoj4889 [Tjoi2017]不勤劳的图书管理员
    CF587F Duff is Mad
  • 原文地址:https://www.cnblogs.com/skyessay/p/9149960.html
Copyright © 2011-2022 走看看