为了账号安全,请及时绑定邮箱和手机立即绑定

启动项目时报错(org.springframework.beans.factory.BeanCreationException)

老师,能帮我看下这个是什么问题么?项目名,配置什么的都是按照您的一样来配置的

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.view.ContentNegotiatingViewResolver#0' defined in ServletContext resource [/WEB-INF/configs/spring/mvc-dispatcher-servlet.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'viewClass' of bean class [org.springframework.web.servlet.view.ContentNegotiatingViewResolver]: Bean property 'viewClass' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1506)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)

at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)

at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:762)

at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)

at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:663)

at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:629)

at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:677)

at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:548)

at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:489)

at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)

at javax.servlet.GenericServlet.init(GenericServlet.java:160)

at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)

at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)

at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1080)

at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5015)

at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5302)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566)

at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556)

at java.util.concurrent.FutureTask.run(FutureTask.java:262)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

at java.lang.Thread.run(Thread.java:745)

Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'viewClass' of bean class [org.springframework.web.servlet.view.ContentNegotiatingViewResolver]: Bean property 'viewClass' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?


https://img1.sycdn.imooc.com//5be792c30001cdfa13650746.jpg

https://img1.sycdn.imooc.com//5be792c30001767313660746.jpg

https://img1.sycdn.imooc.com//5be792c40001109b13660746.jpg

https://img1.sycdn.imooc.com//5be792c60001db6a13660746.jpg


正在回答

1 回答

这个问题是明显viewClass   bean找不到  Does the parameter type of the setter match the return type of the getter?(setter的参数类型是否与getter的返回类型匹配?) 去看下你的get后者set方法是不是写错了,注入不了bean

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
Spring MVC起步
  • 参与学习       195973    人
  • 解答问题       572    个

Java中Spring MVC框架入门教程,快来看最易用的MVC框架

进入课程

启动项目时报错(org.springframework.beans.factory.BeanCreationException)

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信