![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
spring
奋斗ing的小白
努力前行
展开
-
CXF整合spring实现WebService,过程实例
实现web service 大体上需要以下步骤:Web Service编码: @WebService( SEI和SEI的实现类) @WebMethod(SEI中的所有方法) 发布Web Service: Endpoint(终端, 发布webservice) cxf整合spring主要体现在发布的时候由spring的配置文件来配置发布的beanSEI接口packag...原创 2020-03-22 20:10:09 · 311 阅读 · 0 评论 -
spring mvc使用AbstractPdfView 返回pdf视图实现过程
1.环境介绍,maven工程,spring与springmvc注解方式进行整合。让spring管理除controller以外的bean,让spring mvc管理controller bean。2.使用ModelAndView模式,给出视图类代码,并且给bean命名为PdfRevenueSummary:@Component("PdfRevenueSummary")public clas...原创 2020-03-14 16:18:58 · 329 阅读 · 0 评论 -
org.springframework.jdbc.IncorrectResultSetColumnCountException:Incorrect column count: expected 1,
spring使用注解方式整合c3p0连接数据库,然后使用JdbcTemplate查询数据库记录,报错:org.springframework.jdbc.IncorrectResultSetColumnCountException: Incorrect column count: expected 1, actual 5 at org.springframework.jdbc.core.Si...原创 2020-03-07 22:14:32 · 873 阅读 · 0 评论 -
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component
在练习手工整合spring和mybatis的时候,一直报错:org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [D:\eclipseworks\SpringMybatis\bin\spring\mybatis\mapper...原创 2020-02-26 14:14:09 · 692 阅读 · 0 评论 -
Spring 整合Hibernate学习笔记
整合的目的是让IOC 容器来管理 Hibernate 的 SessionFactory,让Hibernate 使用Spring 来进行事务管理。具体步骤:1.加入所需jar包2.添加 hibernate 的配置文件: hibernate.cfg.xml,编写了持久化类对应的 .hbm.xml 文件3.把hibernate加入到spring的配置文件spring整合文件:...原创 2020-02-22 16:36:10 · 235 阅读 · 0 评论 -
Spring对jdbc的事务管理——基于注解方式
还是基于Spring对jdbc的事务管理——基于XML配置文章中的例子,把xml配置换成注解方式。1.bean的注解。//添加标注,让spring自动扫描加载@Componentpublic class AccountDao { @Autowired private JdbcTemplate jdbcTemplate;2.对于事务管理的注解@Service("cashi...原创 2020-02-22 09:24:58 · 240 阅读 · 0 评论 -
Spring对jdbc的事务管理——基于XML配置
jdbc操作数据库的时候,完成一个需求,可能需要多个其他服务一起完成后,才算完成。在这个过程中,就会产生服务是否全都成功了的问题,最直接的后果,会对我们的数据产生影响。比如A转100元给B,A的账户要减掉100,B的账户要加100,这是两个操作,如果只成功了一个,就会产生数据不准的问题,而事务管理简单说就是两个操作都成功算成功,如果其中一个操作失败,就将已经成功了的操作回滚,这样就保证了数据的正确...原创 2020-02-22 09:14:06 · 376 阅读 · 0 评论 -
Spring对JDBC的操作——使用JdbcTemplate操作数据库(二)
使用具名参数的sql操作数据库。具体配置跟Spring对JDBC的操作——使用JdbcTemplate操作数据库(一)的一样,只是在springxml文件配置中,要增加使用具名参数的相关配置。如下:<!-- 添加配置NamedParameterJdbcTemplate具名参数 --> <bean id="namedParameterJdbcTemplate" clas...原创 2020-02-21 14:55:21 · 158 阅读 · 0 评论 -
Spring对JDBC的操作——使用JdbcTemplate操作数据库(一)
步骤1.书写需要测试的各种类①开启mysql数据库,并新建表,插入数据。一般表明对应着类名,字段对应着类的属性名。//②设置类的属性名(为了测试,我们对应着数据库表的字段),并配置get、set方法@Componentpublic class Employer { private int id; private String name; private String email...原创 2020-02-21 14:49:12 · 350 阅读 · 0 评论 -
Spring AOP实现方法二——xml配置
这种加载方式,主要是靠xml文件的配置。1.普通类public class CalculatorAnno { public int add(int i,int j){ int result = i +j; return result; } public int mil(int i,int j){ int result = i - j; return result;...原创 2020-02-20 20:58:47 · 91 阅读 · 0 评论 -
Spring AOP实现方式一——前置注解方式
1.类的注释@Component("calculatorAnno") //bean的前置注释public class CalculatorAnno { public int add(int i,int j){ int result = i +j; return result; } public int mil(int i,int j){ int result = i - ...原创 2020-02-20 20:53:30 · 649 阅读 · 0 评论 -
spring基础-Bean的装配方式(三)自动装配
自动装配使用的是元素的autowire属性。autowire属性有5个值:byName:根据property的name自动装配byType:根据property的数据类型(type)自动装配constructor:根据构造函数参数的数据类型,进行byType模式自动装配autodetect:发现默认的构造函数,使用constructor模式,否则使用byType模式no:不适用自动装配原创 2017-01-04 11:24:01 · 205 阅读 · 0 评论 -
spring基础-Bean的装配方式(二)基于Annotation的配置
Annotation中,常用的注释:@Componet 描述spring中的一个bean@Repository 将数据访问层(Dao层)的类标识为Spring中的bean@Service 将业务层(Service层)的类标识为Spring中的bean@Controller 将控制层的类标识为Spring中的bean@Resource 有两个属性,name和type ,将na原创 2017-01-04 10:54:40 · 952 阅读 · 1 评论 -
spring基础-Bean的装配方式(一)基于xml的装配
spring基础-Bean的装配方式(一)基于xml的装配有两种方式:设置注入和构造注入用例子说明先写一个User类public class User { private String username; private Integer password;//默认构造器 public User(){ super(); }//构造方法注入原创 2017-01-04 09:57:01 · 684 阅读 · 0 评论