当前位置: 首页 > wzjs >正文

手机访问wordpress网站卡网页图片大全

手机访问wordpress网站卡,网页图片大全,高德北斗导航,北海做网站有哪家spring处理使用静态工厂方法获取bean实例,也可以通过实例工厂方法获取bean实例。 实例工厂方法步骤如下: 定义实例工厂类(Java代码),定义实例工厂(xml),定义调用实例工厂&#xff…

spring处理使用静态工厂方法获取bean实例,也可以通过实例工厂方法获取bean实例。

实例工厂方法步骤如下:

定义实例工厂类(Java代码),定义实例工厂(xml),定义调用实例工厂(xml)

定义实例工厂类

该类有实例方法返回所需bean,实例方法可以有参或无参。

package com.itheima.factory;import com.itheima.dao.interfaces.InterfaceUserDao;
import com.itheima.service.interfaces.InterfaceUserService;
import com.itheima.service.impl.UserServiceImpl02;/*** @copyright 2003-2024* @author    qiao wei* @date      2024-12-24* @version   1.0* @brief     实例工厂方法返回Bean。* @history   name*            date*            brief*/
public class MyBeanFactory02 {public InterfaceUserService getUserService() {return new UserServiceImpl02(userDao, 20);}public void setUserServiceA01(InterfaceUserDao userDao) {this.userDao = userDao;}public InterfaceUserDao getUserDaoABC(int value01, InterfaceUserDao userDao01) {
//        System.out.println("Int:" + value01);return userDao01;}private InterfaceUserDao userDao;
}

方法getUserService和方法getUserDaoABC分别返回bean对象。

定义实例工厂(xml),定义调用实例工厂(xml)

<?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:p="http://www.springframework.org/schema/p"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-4.0.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsdhttp://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsdhttp://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop-4.0.xsd"><!--    <bean id="userDaoInstance"-->
<!--          class="com.itheima.dao.impl.UserDaoImpl">-->
<!--    </bean>--><import resource="../dao/userDaoImpl.xml"/><!--实例工厂的实例方法(无参方法)返回第三方bean。1:定义Bean“myBeanFactoryA002”。工厂方法通过其它设置进行设置,随后将设置好的数据传递给工厂方法。2:定义实例工厂。该工厂绑定实例工厂类“myBeanFactoryA002”,调用无参实例方法“getUserService”返回Bean。--><bean id="myBeanFactoryA002"class="com.itheima.factory.MyBeanFactory02"></bean><bean id="getBeanWithoutParam"factory-bean="myBeanFactoryA002"factory-method="getUserService"></bean><!--实例工厂的实例方法(有参方法)返回第三方bean。1:factory-bean指定实例工厂类。2:factory-method指定工厂类的实例有参方法“getUserDaoABC”,该方法返回Bean。注:方法参数要按照方法中定义顺序赋值,改变顺序报错。--><bean id="getBeanWithParam"factory-bean="myBeanFactoryA002"factory-method="getUserDaoABC"><!-- 基本类型int参数 --><constructor-arg name="value01"value="100"></constructor-arg><!-- 引用类型"com.itheima.dao.impl.UserDaoImpl" --><constructor-arg name="userDao01"ref="userDaoImpl001"></constructor-arg></bean>
</beans>

可以看到,getBeanWithParam和getBeanWithoutParam都是通过调用实例工myBeanFactoryA002取得bean实例,不同之处只是一个方法无参,一个方法有参。


文章转载自:

http://6I4miil6.Lydtr.cn
http://DdNVHiOK.Lydtr.cn
http://Nrp0QDB6.Lydtr.cn
http://o74NUHxY.Lydtr.cn
http://Ehs2TLoA.Lydtr.cn
http://7v4ivMFF.Lydtr.cn
http://yhNNxG3c.Lydtr.cn
http://U6oyI1C1.Lydtr.cn
http://5UEqtLR0.Lydtr.cn
http://GAMFuh07.Lydtr.cn
http://4tHe0eMJ.Lydtr.cn
http://W94N43SX.Lydtr.cn
http://MC7q6xJm.Lydtr.cn
http://4XxI6BSB.Lydtr.cn
http://F7ejMuci.Lydtr.cn
http://w1cBUkCL.Lydtr.cn
http://S20movHK.Lydtr.cn
http://5o6bWtNe.Lydtr.cn
http://8ailfLrA.Lydtr.cn
http://ZIRId1lj.Lydtr.cn
http://d2pL25ku.Lydtr.cn
http://ve0X8m6H.Lydtr.cn
http://oZlZsWad.Lydtr.cn
http://JKjcAQr0.Lydtr.cn
http://30aNgwyY.Lydtr.cn
http://BZ9Txj0X.Lydtr.cn
http://PloSHtAW.Lydtr.cn
http://kF2kc7wT.Lydtr.cn
http://3uLzupKS.Lydtr.cn
http://U6j3n3nS.Lydtr.cn
http://www.dtcms.com/wzjs/639330.html

相关文章:

  • 网站信息抽查评估网站上传服务器后台上传资料出错
  • 百度免费网站如何建设网站建设策划方案模板
  • 内蒙能源建设集团网站外贸网站有哪些?
  • 电商的网站怎么做的镇网站制作价格
  • 织梦做旅游网站asp.net 4.0网站开发与项目实战
  • 国外的建筑设计案例网站网络推广团队分工
  • 昆明优化广告公司搜索引擎优化seo培训
  • 下载素材第三方网站是怎么做推广公司有哪些公司
  • html5 网站自适应next.js做纯静态网站
  • 用手机可以做网站吗天元建设集团有限公司第六分公司
  • 潍坊网站收录水母智能在线设计平台
  • 上海网站建设官方网站新浪邮箱登录网页
  • 创可贴网页设计网站网站开发应用到的技术名词
  • 动易网站系统怎么样毕业设计做网站功能实现不出怎么办
  • 百度做网站的电话网站优化公司 网络服务
  • 网站运营做内容我国中小企业名单
  • 网站界面设计psWordPress和cos
  • 凡客做网站重庆雕塑制作
  • 商丘网站制作教程长沙网络推广代理
  • 嘉兴本地推广网站有哪些网站修改 iis6应用程序池
  • 深深圳的网站建设公司谷雨网页设计作业
  • 网站外链有多重要专门做名片的网站
  • 阿里云服务器 做网站免费无代码开发平台本地部署
  • 网站安全检测工具网站wordpress sydney主题
  • 自己做网站的给微信取个什么名字好河南网站优化
  • 河南核酸检测vip整站seo教程
  • 辽阳银梦网站建设微信直接下载安装
  • 天津网站设计 河西html5视频标签
  • 中天建设集团门户网站动漫制作专业零基础
  • 发布网站后备案找个人给我做电影网站