小编Yog*_*gun的帖子

如果它还没有在mongoDB中自动创建一个集合?

我正在使用mongoose为节点创建护照身份验证.我的数据库中没有任何名为"users"的集合.但是在使用下面的架构创建新用户时

var mongoose = require('mongoose');

 module.exports = mongoose.model('User',{
id: String,
username: String,
password: String,
email: String,
firstName: String,
lastName: String
});
Run Code Online (Sandbox Code Playgroud)

它会自动创建新的"用户"集合.这怎么可能?

collections schema mongoose mongodb

9
推荐指数
2
解决办法
8961
查看次数

UnsatisfiedDependencyException:创建名为“homeController”的 bean 时出错:通过字段“userDAO”表达的不满意依赖

我正在尝试连接 eclipse spring maven 的后端和前端两个独立的项目。我为此添加了依赖项。但是当我在 Homecontroller.java 中写下验证凭证逻辑时,在服务器上运行后它显示了这个异常。请帮助解决它我已经尝试了很多方法,请提出建议。

主控制器.java

package com.yogesh.shoponlinefrontend.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import com.yogesh.shoponlineback.dao.UserDAO;
import com.yogesh.shoponlineback.model.User;

@Controller
public class HomeController {


@Autowired
UserDAO userDAO;


@RequestMapping("/")
public String homePage() {
    System.out.println("Executing  the method homePage");
    return "home";
}

@RequestMapping("/login")
public ModelAndView showLoginPage() {

    ModelAndView mv = new ModelAndView("home");
    mv.addObject("msg", "You clicked login link");
    mv.addObject("showLoginPage", "true");
    return mv;
}

@RequestMapping("/register")
public ModelAndView showRegistrationPage() {
    ModelAndView mv = new ModelAndView("home");

    mv.addObject("msg", "You clicked Registration …
Run Code Online (Sandbox Code Playgroud)

spring dependencies exception

4
推荐指数
1
解决办法
9万
查看次数