急急急!SSH问题,No setter found for property 'tTreeDao' in class 'com.web.bo.Home.TTre

yyil80 2011-01-07 10:04:21
我在applicationContext.xml中配置如下
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

<!-- 创建sessionFactory -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation">
<value>file:hibernate.cfg.xml</value>
</property>
</bean>

<!-- 事务管理器 -->
<bean id="tm" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<!-- 2.0事务 -->
<tx:advice id="txadvice" transaction-manager="tm">
<tx:attributes>
<tx:method name="get*" propagation="REQUIRED" />
<tx:method name="find*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="delete*" propagation="REQUIRED" />
<tx:method name="add*" propagation="REQUIRED" />
<tx:method name="*" propagation="REQUIRED" />
</tx:attributes>
</tx:advice>

<aop:config>
<aop:pointcut id="bizs"
expression="execution(* bo.*.*(..))" />
<aop:advisor advice-ref="txadvice" pointcut-ref="bizs" />
</aop:config>



<!-- bo配置 -->
<bean id="tTreeBo" class="com.web.bo.Home.TTreeBo">
<property name="tTreeDao"> <!--这里报错No setter found for property 'tTreeDao' in class 'com.web.bo.Home.TTreeBo'-->
<ref local="tTreeDao"/>
</property>
<property name="tAuthorityBo"><!--这里报错No setter found for property 'tAuthorityBo' in class 'com.web.bo.Home.TTreeBo'-->

<ref local="tAuthorityBo"/>
</property>
</bean>
<bean id="tAuthorityBo" class="com.web.bo.Home.TAuthorityBo">
<property name="tAuthorityDao"> <!--这里报错No setter found for property 'tAuthorityDao' in class 'com.web.bo.Home.TAuthorityBo'-->

<ref local="tAuthorityDao"/>
</property>
</bean>

<!-- dao配置 -->
<bean id="tTreeDao" class="com.web.dao.Home.TTreeDao">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="tAuthorityDao" class="com.web.dao.Home.TAuthorityDao">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>

</beans>



在bo里面代码:
package com.web.bo.Home;

import java.util.ArrayList;
import java.util.List;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

import com.web.dao.Home.TTreeDao;
import com.web.po.TAuthority;
import com.web.po.TRole;
import com.web.po.TTree;

public class TTreeBo {

private TTreeDao tTreeDao;
private TAuthorityBo tAuthorityBo;

public TTreeDao getTTreeDao() {
return tTreeDao;
}


public void setTTreeDao(TTreeDao treeDao) {
tTreeDao = treeDao;
}


public TAuthorityBo getTAuthorityBo() {
return tAuthorityBo;
}


public void setTAuthorityBo(TAuthorityBo authorityBo) {
tAuthorityBo = authorityBo;
}


/**
* 根据角色查找出对应的功能
* @param role
* @return
*/
public List<TTree> getTree(TRole tRole){
TAuthority ta=new TAuthority();
ta.setTRole(tRole);
List<TTree> list=new ArrayList<TTree>();
//tAuthorityBo.findByRole(ta)会返回一个List<TAuthority>
for(TAuthority t:tAuthorityBo.findByRole(ta)){
list.add(t.getTTree());
}
return list;
}

public static void main(String[] args) {
TRole tRole=new TRole();
tRole.setName("dd");
ApplicationContext context=new FileSystemXmlApplicationContext("src/applicationContext.xml");
TTreeBo bo=(TTreeBo)context.getBean("TTreeBo");
List<TTree> list=bo.getTree(tRole);
System.out.println(list.size());
}
}


求各位大侠帮忙解决,先谢谢了
...全文
428 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
米西米西 2011-07-26
  • 打赏
  • 举报
回复
回头看看以前干的那些傻事“jf”,不过这个问题让我记住了,所以我再也没有犯过同样的错拉~~
看来这样子做,还是有好处的哦~~
蒙面客 2011-01-07
  • 打赏
  • 举报
回复
错误很明显,没有找到哪个 字段的set方法~~~~
米西米西 2011-01-07
  • 打赏
  • 举报
回复
大小写的问题,字段名用小写就搞定啦~~~~~~
tt986101dpc 2011-01-07
  • 打赏
  • 举报
回复
不是已经解决了么。。。汗
jelon520 2011-01-07
  • 打赏
  • 举报
回复
代码太多了,飘过。
yyil80 2011-01-07
  • 打赏
  • 举报
回复

package com.web.bo.Home;

import java.util.ArrayList;
import java.util.List;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

import com.web.dao.Home.TTreeDao;
import com.web.po.TAuthority;
import com.web.po.TRole;
import com.web.po.TTree;

public class TTreeBo {

private TTreeDao tTreeDao;
private TAuthorityBo tAuthorityBo;


public TTreeDao getTTreeDao() {
return tTreeDao;
}


public void setTTreeDao(TTreeDao treeDao) {
tTreeDao = treeDao;
}


public TAuthorityBo getTAuthorityBo() {
return tAuthorityBo;
}


public void setTAuthorityBo(TAuthorityBo authorityBo) {
tAuthorityBo = authorityBo;
}


/**
* 根据角色查找出对应的功能
* @param role
* @return
*/
public List<TTree> getTree(TRole tRole){
TAuthority ta=new TAuthority();
ta.setTRole(tRole);
List<TTree> list=new ArrayList<TTree>();
//tAuthorityBo.findByRole(ta)会返回一个List<TAuthority>
for(TAuthority t:tAuthorityBo.findByRole(ta)){
list.add(t.getTTree());
}
return list;
}

public static void main(String[] args) {
TRole tRole=new TRole();
tRole.setName("dd");
ApplicationContext context=new FileSystemXmlApplicationContext("src/applicationContext.xml");
TTreeBo bo=(TTreeBo)context.getBean("TTreeBo");
List<TTree> list=bo.getTree(tRole);
System.out.println(list.size());
}
}

liuchao1989 2011-01-07
  • 打赏
  • 举报
回复
setter found for property 'tTreeDao' in class 'com.web.bo.Home.TTre

在com.web.bo.Home.TTre 类中
没有找到 tTreeDao 的set方法。
你看你怎么配置的。
happyfmy 2011-01-07
  • 打赏
  • 举报
回复
具体报错信息
<bean id="tAuthorityBo" class="com.web.bo.Home.TAuthorityBo">
这个类呢

代码贴得乱糟糟 谁会看啊
yyil80 2011-01-07
  • 打赏
  • 举报
回复
有人来吗????到底是怎么回事啊,我的代码里面明明有get和set方法,为什么报错啊???
yyil80 2011-01-07
  • 打赏
  • 举报
回复
大家快来帮我解决问题啊。。
yyil80 2011-01-07
  • 打赏
  • 举报
回复
有人来帮我解决没????
yyil80 2011-01-07
  • 打赏
  • 举报
回复
9楼正解,谢谢了,纠结了我好久

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧