随笔分类 - 学习Spring
学习Spring框架知识
摘要:自定义Spring属性编辑器流程:1,编写被解析类和解析类Address,Customer; 2,定义一个属性编辑器AddressPropertyEditor,继承于PropertyEditorSupport类,重写里面setAsText()方法; 3,定义一个属性编辑器注册器AddressProp
阅读全文
摘要:整体流程: 自定义一个<msb:user username email age>,完成整个标签的处理工作流程:1,需要解析的实体类User; 2,自定义标签解析器UserBeanDefinitionParser,继承于AbstractSingleBeanDefinitionParser,重写两个方法
阅读全文
摘要:1,实体类 Student.javapackage com.mashibing.bean;public class Student { private Integer age; private String name; public Student() { System.out.println("s
阅读全文
摘要:3、spring创建第三方bean对象 在Spring中,很多对象都是单实例的,在日常的开发中,我们经常需要使用某些外部的单实例对象,例如数据库连接池,下面我们来讲解下如何在spring中创建第三方bean实例。 1、导入数据库连接池的pom文件 <dependency> <groupId>co
阅读全文
摘要:11、bean对象的初始化和销毁方法 在创建对象的时候,我们可以根据需要调用初始化和销毁的方法 Address.java package com.mashibing.bean;public class Address { private String province; private Stri
阅读全文
摘要:1、通过bean的id获取IOC容器中的对象 SpringDemoTest.java import com.mashibing.bean.Person;import org.springframework.context.ApplicationContext;import org.springfra
阅读全文
摘要:01、spring IOC基本使用 (1)使用maven的方式来构建项目 定义项目的groupId、artifactId (2)添加对应的pom依赖 4.0.0 <groupId>com.mashibing</groupId> <artifactId>springHelloword23</artif
阅读全文
摘要:org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'myCalculator' is expected to be of type 'com.mashibing.service.MyCalcula
阅读全文

浙公网安备 33010602011771号