zoukankan      html  css  js  c++  java
  • org.springframework.beans.NotWritablePropertyException:Bean property 'xxxService' is not writable or has an invalid setter method.

    • 完整报错提示信息:Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'blogDetailsService' of bean class [com.blog.action.BlogDetailsAction]: Bean property 'blogDetailsService' is not writable or has an invalid setter method. Did you mean 'blogDetailService'?
    • 解决方案:
    1. 保证applicationContext.xml中注入的属性名称与com.blog.action.BlogDetailsAction中属性名称相同

        1.1 applicationContext.xml:

    <bean name="blogDetailsActionBean" class="com.blog.action.BlogDetailsAction">
        <property name="blogDetailsService" ref="blogDetailsServiceImpl" />
    </bean>

       1.2 BlogDetailsAction.java

    BlogDetailsService blogDetailsService;
    public BlogDetailsService getBlogDetailsService() {
        return blogDetailsService;
    }
    
    public void setBlogDetailService(BlogDetailsService blogDetailsService) {
        this.blogDetailsService = blogDetailsService;
    }

      注:一般来说这样就可以解决问题了,但我这里不知道为什么必须将blogDetailsService全部都改成blogDetailService才可以运行。

      原因:修改的struts.xml未生效。重开工作空间解决。


         

      

    curie.
  • 相关阅读:
    14、python基础
    13、Python入门
    12、运算符、流程控制
    10、Linux(六)
    Windows 分层窗口 桌面上透明 Direct3D
    Windows 进程间通信 共享内存
    Linux 库的使用
    FFmpeg 命令行
    FFmpeg 摄像头采集
    FFmpeg input与output 函数流程
  • 原文地址:https://www.cnblogs.com/curie/p/12066152.html
Copyright © 2011-2022 走看看