码迷,mamicode.com
首页 > 编程语言 > 详细

spring boot包扫描不到controller层

时间:2018-06-07 13:56:09      阅读:366      评论:0      收藏:0      [点我收藏+]

标签:一个   tran   nts   错误   ica   map   tis   text   col   

启动类代码

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的代码是另外一个子模块,低级错误。

 

spring boot包扫描不到controller层

标签:一个   tran   nts   错误   ica   map   tis   text   col   

原文地址:https://www.cnblogs.com/skyessay/p/9149960.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!