小台的IT备忘录  
脑子越来越不好用,只能依靠烂笔头了~

错误描述:conflicts with existing, non-compatible bean definition of same name and class 看错误描述是相同的类名冲突,它自己不会分辨包,我们可以自己加注解来区分他们

import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/admin")
@Component("AdminLogin")//同名类需要写Component来区分
public class LoginController {
    @RequestMapping("")//根路由需要写空Mapping
    public String Login() {
        return "/admin/login/index";
    }
}
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/agent")
@Component("AgentLogin")
public class LoginController {
    @RequestMapping("")
    public String Login() {
        return "/agent/login/index";
    }
}

 

posted on 2018-07-19 14:31  taiyonghai  阅读(731)  评论(0编辑  收藏  举报