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

竹子建站官网有哪些做笔译的网站

竹子建站官网,有哪些做笔译的网站,创意型网站建设,网站如何赚钱在Spring容器加入一个实现了BeanPostProcessor接口bean实例#xff0c;重写postProcessBeforeInitialization、postProcessAfterInitialization方法#xff0c;在方法里面写具体的实现#xff0c;从而达到Spring容器在初如化前或销毁时执行预定的程序#xff0c;方法如下重写postProcessBeforeInitialization、postProcessAfterInitialization方法在方法里面写具体的实现从而达到Spring容器在初如化前或销毁时执行预定的程序方法如下 1、pop.xml导包   dependencygroupIdorg.springframework/groupIdartifactIdspring-context/artifactIdversion5.3.37/version /dependency dependency 2、写一个类实现BeanPostProcessor接口同时写一个User实体类用于测试 实现类 package test.spring.model;import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanPostProcessor;public class LifeBeanAware implements BeanPostProcessor {Overridepublic Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {// TODO Auto-generated method stubSystem.out.println(前置处理);return null;}Overridepublic Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {// TODO Auto-generated method stubSystem.out.println(后置处理);return null;}} User类 /** *Description: *author: ljd *date 2024年7月2日 *version 1.0 */ package test.spring.model;public class User {private int id;private String name;public int getId() {return id;}public void setId(int id) {System.out.println(user赋值);this.id id;}public String getName() {return name;}public void setName(String name) {this.name name;}public void testPrint() {System.out.println(this is test init function);}Overridepublic String toString() {return User [id id , name name ];}public User() {super();}} 3、applicationContext.xml配置 ?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beansxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdbean iduser1 init-methodtestPrint destroy-methodtestPrint classtest.spring.model.User property nameid value1/propertyproperty namename valuezs/property/beanbean classtest.spring.model.LifeBeanAware/bean /beans 4、测试结果 /** *Description: *author: ljd *date 2024年7月2日 *version 1.0 */ package testSpring;import org.junit.Test; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext;import test.spring.model.User;public class TestSpring {Testpublic void testUser() {ConfigurableApplicationContext acnew ClassPathXmlApplicationContext(applicationContext.xml);User userac.getBean(User.class); System.out.println(user);ac.close();}}
http://www.w-s-a.com/news/387912/

相关文章:

  • 祥云平台官方网站网线制作实验原理
  • 把网站做成app的软件下载国外做兼职的网站有哪些
  • 网站建设 海豚弯专业的网站开发服务商
  • 那个网站有免费模板中国家装公司十大排名
  • 中铁建设集团有限公司门户网站余杭区建设规划局网站
  • 天猫网站建设的目标是什么做网站常见问题模板
  • 做php网站需要什么软件天津建设网官方网站
  • 南漳网站开发上海网站推广方法
  • 深圳seo网站大连旅顺房价
  • dede网站 地图什么做有没有做黑市网站
  • 做网站参考文献域名如何做网站
  • 怎么选择网站开发英文网站建设用途
  • 怎样做电子商务网站织梦生成手机网站
  • 公司网站建设选什么服务器网站里怎样添加关键词
  • 深圳建设局网站深业中城绿化项目营销型网站开发流程包括
  • 找销售的网站九江市建设项目服务中心
  • 东原ARC网站建设公司合肥seo网站推广外包
  • 那个网站是做房产中介的网站制作软件小学
  • 做网页怎么建站点视频解析网站
  • 做网站的系统设计网站设计论文前言
  • 做外贸网站多久更新汕头市建设局网站首页
  • 如何建设专业化的网站手机管理网站模板
  • 花生壳做网站如何用腾讯云做网站
  • 搭建集团网站开发app需要哪些软件
  • 网站建设 中企动力福州阀门wordpress 多说评论
  • php网站集成支付宝接口下载免费网络软件
  • 卡盟网站是怎么建设的用花生壳做网站速度可以吗
  • 杭州物联网前十名公司优秀seo平台
  • 网新中英企业网站管理系统wordpress 登录 缓存
  • wordpress模板建站教程wordpress添加广告位手机自适应