我正在尝试使用 hibernate 设置 spring rest api。尝试使用我设置的 userRespository 时出现此错误
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userController': Unsatisfied dependency expressed through field 'userService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userServiceImpl': Unsatisfied dependency expressed through field 'userRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Not a managed type: class com.potholeapi.models.User
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596) ~[spring-beans-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) ~[spring-beans-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) ~[spring-beans-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1411) ~[spring-beans-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) ~[spring-beans-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.8.RELEASE.jar:5.1.8.RELEASE] …Run Code Online (Sandbox Code Playgroud) 我正在尝试根据对localhost:3000/api/student的 POST 请求创建和插入在以下模型中定义的“用户”json 文档。使用邮递员发送 POST 请求时遇到以下错误:
TypeError: Cannot read property 'name' of undefined
at module.exports.makeStudent (/home/tyler/Dropbox/Projects/Curricula/API/controllers/student.js:17:22)
at Layer.handle [as handle_request] (/home/tyler/Dropbox/Projects/Curricula/node_modules/express/lib/router/layer.js:95:5)
at next (/home/tyler/Dropbox/Projects/Curricula/node_modules/express/lib/router/route.js:131:13)
at Route.dispatch (/home/tyler/Dropbox/Projects/Curricula/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/home/tyler/Dropbox/Projects/Curricula/node_modules/express/lib/router/layer.js:95:5)
at /home/tyler/Dropbox/Projects/Curricula/node_modules/express/lib/router/index.js:277:22
at Function.process_params (/home/tyler/Dropbox/Projects/Curricula/node_modules/express/lib/router/index.js:330:12)
at next (/home/tyler/Dropbox/Projects/Curricula/node_modules/express/lib/router/index.js:271:10)
at Function.handle (/home/tyler/Dropbox/Projects/Curricula/node_modules/express/lib/router/index.js:176:3)
at router (/home/tyler/Dropbox/Projects/Curricula/node_modules/express/lib/router/index.js:46:12)
Run Code Online (Sandbox Code Playgroud)
以下是我认为的相关文件
API/模型/student.js
var mongoose = require('mongoose')
var studentSchema = new mongoose.Schema({
name: {type: String, required: true},
password: {type: String, required: true},
classes: [Number]
});
mongoose.model('Student', studentSchema);
Run Code Online (Sandbox Code Playgroud)
API/控制器/student.js
var mongoose = require('mongoose');
var …Run Code Online (Sandbox Code Playgroud) 当我编译这行时,74出现是一个非法的表达开始,为什么会这样?我完全无法弄清楚这一点,任何帮助都将非常感谢谢谢.
import java.awt.*;
import javax.swing.*;
public class NumericKeypadPanel2 extends JPanel
{
public NumericKeypadPanel2()
{
String num = " ";
JPanel panel_main = new JPanel();
panel_main.setLayout(new BorderLayout());
JPanel keypad = new JPanel();
keypad.setLayout(new GridLayout (4, 3));
keypad.setBorder (BorderFactory.createLineBorder (Color.black, 3));
JButton b1 = new JButton ("1");
JButton b2 = new JButton ("2");
JButton b3 = new JButton ("3");
JButton b4 = new JButton ("4");
JButton b5 = new JButton ("5");
JButton b6 = new JButton ("6");
JButton b7 = new JButton …Run Code Online (Sandbox Code Playgroud) java ×2
express ×1
expression ×1
javascript ×1
mongodb ×1
mongoose ×1
node.js ×1
spring ×1
spring-boot ×1
spring-data ×1
syntax ×1