• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
Y-wee
博客园    首页    新随笔    联系   管理     
上一页 1 ··· 21 22 23 24 25 26 27 28 29 下一页
2020年10月15日
spring中FactoryBean类的用法
摘要: spring中FactoryBean类的用法 1、简介 工厂bean,它是作用主要就是创建bean对象 2、如何使用 2.1、编写实体类 package com.yl.bean; public class Car { private String brand; private Integer pri 阅读全文
posted @ 2020-10-15 16:38 Y-wee 阅读(321) 评论(0) 推荐(0)
spring基于xml导入配置文件
摘要: spring基于xml导入配置文件 在原先的bean的xml配置文件导入另外的bean xml配置文件,都受同一个IOC容器的管理及配置 用法 <!--导入bean1.xml文件的内容--> <import resource="bean1.xml" /> 阅读全文
posted @ 2020-10-15 16:17 Y-wee 阅读(152) 评论(0) 推荐(0)
spring中bean的继承和依赖关系
摘要: spring中bean的继承和依赖关系 1、bean之间的继承 将公共的配置写到父bean,子bean直接继承即可使用 举例 定义一个父bean <!--实现bean之间的继承关系--> <bean id="parentCar" class="com.gec.bean.Car" > <propert 阅读全文
posted @ 2020-10-15 16:15 Y-wee 阅读(347) 评论(0) 推荐(0)
spring整合junit
摘要: spring整合junit 首先准备好spring项目,新建spring项目可以参考以下资料 spring基于xml配置入门案例 spring注解入门案例 spring纯注解案例 这里就不再阐述怎么新建spring项目了,准备好spring项目环境之后,就可以开始spring整合junit了 1、导 阅读全文
posted @ 2020-10-15 14:17 Y-wee 阅读(273) 评论(0) 推荐(0)
spring新注解说明
摘要: spring新注解说明 @Configuration、@ComponentScan在纯注解案例中已经说明,就不再阐述;这里主要讲一下@PropertySource、@Import、@Bean 1、@PropertySource 作用:用于加载.properties文件中的配置。例如我们配置数据源时, 阅读全文
posted @ 2020-10-15 11:24 Y-wee 阅读(113) 评论(0) 推荐(0)
spring纯注解案例
摘要: spring纯注解案例 我们发现,之所以我们现在离不开xml配置文件,是因为我们有一句很关键的配置: <!-- 告知spring框架在,读取配置文件,创建容器时,扫描注解,依据注解创建对象,并存入容器中 --> <context:component-scan base-package=**"com. 阅读全文
posted @ 2020-10-15 11:03 Y-wee 阅读(176) 评论(0) 推荐(0)
spring常用注解的使用
摘要: spring常用注解的使用 1、用于创建对象 相当于: 1.1、@Component 作用:把资源让spring来管理,相当于在xml中配置一个bean。 属性 value:指定bean的id;如果不指定value属性,默认bean的id是当前类的类名,首字母小写。 1.2、@Controller、 阅读全文
posted @ 2020-10-15 10:41 Y-wee 阅读(141) 评论(0) 推荐(0)
spring注解入门案例
摘要: spring注解入门案例 基于maven项目 1、准备jar包 <!-- https://mvnrepository.com/artifact/org.springframework/spring-context --> <dependency> <groupId>org.springframewo 阅读全文
posted @ 2020-10-15 10:05 Y-wee 阅读(153) 评论(0) 推荐(0)
2020年10月14日
内部bean和级联属性的用法
摘要: 内部bean和级联属性的用法 1、内部bean 内部Bean和Java的匿名内部类相似,既没有名字,也不能被其他Bean引用,只能在声明处为外部Bean提供实例注入 配置文件 <bean id="boss2" class="com.gec.bean.Boss"> <property name="bo 阅读全文
posted @ 2020-10-14 16:40 Y-wee 阅读(168) 评论(0) 推荐(0)
spring中ref标签的用法
摘要: spring中ref标签的用法 1、作用 将对象值注入到对应的属性,依赖于配置标签实现 2、属性 bean:通过该属性可以引用同一容器或父容器中的bean对象 parent: 引用父容器中的bean 3、用法 bean属性用法比较简单,这里就不再介绍,主要讲一下parent属性的用法 前提 一个Bo 阅读全文
posted @ 2020-10-14 15:08 Y-wee 阅读(1904) 评论(0) 推荐(2)
上一页 1 ··· 21 22 23 24 25 26 27 28 29 下一页
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3