* @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
然后再删除接口上的注解 只保留实现类上面的 以后启动服务器就都正常了 为什么会这样 ?只标注在实现类上 首次启动服务器就是报类未定义异常
自动扫描配置部分
<?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
解决方案 »
- ThreadLocal问题
- servlet调用dll问题,Can't find dependent libraries
- 大虾们,帮帮忙,看下这个错误是怎么回事,主要是配置方面吧
- Oracle中存储大字符串问题!!
- 集群环境下定时任务
- (有点难度)Apache+jboss配置服务器,如何设置2级域名?如何指定文件目录?
- 一个奇怪的中文问题(在webshpere下没人回答才发到这儿的)
- 如何将页面上某个控件的值传递给一个bean处理?使用usebean。
- 如何在JBuilder下打开一个XML文件?急!!
- Spring boot怎么实现页面转发后获取上一个页面model里面的值
- ssh集成时不能穿件actionform
- struts1中ActionForm的validate()方法的疑问
在就是注意你注释的位置》。。
jdk6 应该支持 位置就在类声明的上一行
关键是每个Service Bean只有一次报异常 下次启动时就好了 再加一个服务bean 还是那个样 先在接口上也标上注解 (不标上就异常)正常启动后就可以删除接口注解了了 以后启动都没问题 问题摸索着解决了 就是不知道什么原因