* @Service注解要标在实现类上面   服务bean面向接口编程(有时候需要先标在接口和实现类上,启动web(Tomcat)服务器一次  正常 
然后再删除接口上的注解   只保留实现类上面的     以后启动服务器就都正常了   为什么会这样  ?只标注在实现类上  首次启动服务器就是报类未定义异常
自动扫描配置部分
<?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:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
           http://www.springframework.org/schema/context
           http://www.springframework.org/schema/context/spring-context-2.5.xsd
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
 
<context:component-scan base-package="com.mysite.cms" />类所在包名是com.mysite.cms.service和com.mysite.cms.service.impl

解决方案 »

  1.   

    你的JDK版本支持你的那种注释吗?
    在就是注意你注释的位置》。。
      

  2.   


    jdk6 应该支持 位置就在类声明的上一行
    关键是每个Service Bean只有一次报异常  下次启动时就好了   再加一个服务bean   还是那个样  先在接口上也标上注解 (不标上就异常)正常启动后就可以删除接口注解了了  以后启动都没问题   问题摸索着解决了   就是不知道什么原因