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

综合网站系统宁波谷歌seo

综合网站系统,宁波谷歌seo,涂料网站模板,小微型企业网站建立目录 一、作用二、常见的bean后处理器2.1 AutowiredAnnotationBeanPostProcessor2.1.1 说明2.1.2 代码示例2.1.3 截图示例 2.2 CommonAnnotationBeanPostProcessor2.2.1 说明2.2.2 代码示例2.2.3 截图示例 2.3 ConfigurationPropertiesBindingPostProcessor2.3.1 说明2.3.2 代码…

目录

      • 一、作用
      • 二、常见的bean后处理器
        • 2.1 AutowiredAnnotationBeanPostProcessor
          • 2.1.1 说明
          • 2.1.2 代码示例
          • 2.1.3 截图示例
        • 2.2 CommonAnnotationBeanPostProcessor
          • 2.2.1 说明
          • 2.2.2 代码示例
          • 2.2.3 截图示例
        • 2.3 ConfigurationPropertiesBindingPostProcessor
          • 2.3.1 说明
          • 2.3.2 代码示例
          • 2.3.3 截图示例

一、作用

  • 1.为bean生命周期的各个阶段提供扩展
  • 2.实例化前、实例化后、依赖注入阶段、初始化前、初始化后、销毁之前提供扩展

二、常见的bean后处理器

2.1 AutowiredAnnotationBeanPostProcessor
2.1.1 说明
  • 1. 用来解析@Autowired @Value注解
2.1.2 代码示例
package com.learning.bean_processor;public class Dog {
}
package com.learning.bean_processor;import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;public class Person {private Dog dog;@Autowiredpublic void setDog(Dog dog) {System.out.println("@Autowired生效:" + dog);this.dog = dog;}private String home;@Autowiredpublic void setHome(@Value("${JAVA_HOME}") String home){System.out.println("@Value生效:" + home);this.home = home;}}
package com.learning.bean_processor;import org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor;
import org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor;
import org.springframework.context.annotation.CommonAnnotationBeanPostProcessor;
import org.springframework.context.annotation.ContextAnnotationAutowireCandidateResolver;
import org.springframework.context.support.GenericApplicationContext;/*** Bean后处理器*/
public class BeanProcessorTest {public static void main(String[] args) {GenericApplicationContext genericApplicationContext = new GenericApplicationContext();// 用原始方法注册三个BeangenericApplicationContext.registerBean("person", Person.class);genericApplicationContext.registerBean("dog", Dog.class);genericApplicationContext.getDefaultListableBeanFactory().setAutowireCandidateResolver(new ContextAnnotationAutowireCandidateResolver());// 解析@Autowired @Value注解genericApplicationContext.registerBean(AutowiredAnnotationBeanPostProcessor.class);// 初始化容器// 执行beanFactory后处理器,添加bean后处理器,初始化所有单例genericApplicationContext.refresh();// 销毁容器genericApplicationContext.close();}
}
2.1.3 截图示例

在这里插入图片描述

2.2 CommonAnnotationBeanPostProcessor
2.2.1 说明
  • 1. 解析@Resource @PostConstruct @PreDestroy
2.2.2 代码示例
package com.learning.bean_processor;public class Cat {
}
package com.learning.bean_processor;import javax.annotation.Resource;public class Person {private Cat cat;@Resourcepublic void setCat(Cat cat) {System.out.println("@Resource:" + cat);this.cat = cat;}}
package com.learning.bean_processor;import org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor;
import org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor;
import org.springframework.context.annotation.CommonAnnotationBeanPostProcessor;
import org.springframework.context.annotation.ContextAnnotationAutowireCandidateResolver;
import org.springframework.context.support.GenericApplicationContext;/*** Bean后处理器*/
public class BeanProcessorTest {public static void main(String[] args) {GenericApplicationContext genericApplicationContext = new GenericApplicationContext();// 用原始方法注册三个BeangenericApplicationContext.registerBean("person", Person.class);genericApplicationContext.registerBean("cat", Cat.class);// 解析@Resource @PostConstruct @PreDestroygenericApplicationContext.registerBean(CommonAnnotationBeanPostProcessor.class);// 初始化容器// 执行beanFactory后处理器,添加bean后处理器,初始化所有单例genericApplicationContext.refresh();// 销毁容器genericApplicationContext.close();}
}
2.2.3 截图示例

在这里插入图片描述

2.3 ConfigurationPropertiesBindingPostProcessor
2.3.1 说明
  • 1. springboot中配置文件属性绑定bean的增强
  • 2. 需要引用springboot的包
2.3.2 代码示例
package com.learning.bean_processor;import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;@Data
@ConfigurationProperties(prefix = "java")
public class JavaProperties {private String home;private String version;}
package com.learning.bean_processor;import org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor;
import org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor;
import org.springframework.context.annotation.CommonAnnotationBeanPostProcessor;
import org.springframework.context.annotation.ContextAnnotationAutowireCandidateResolver;
import org.springframework.context.support.GenericApplicationContext;/*** Bean后处理器*/
public class BeanProcessorTest {public static void main(String[] args) {GenericApplicationContext genericApplicationContext = new GenericApplicationContext();// 把springboot中的ConfigurationPropertiesBindingPostProcessor后处理器加到容器中// 解析@ConfigurationPropertiesConfigurationPropertiesBindingPostProcessor.register(genericApplicationContext.getDefaultListableBeanFactory());genericApplicationContext.registerBean("java_home", JavaProperties.class);// 初始化容器// 执行beanFactory后处理器,添加bean后处理器,初始化所有单例genericApplicationContext.refresh();System.out.println(genericApplicationContext.getBean(JavaProperties.class));// 销毁容器genericApplicationContext.close();}
}
2.3.3 截图示例

在这里插入图片描述


文章转载自:
http://marv.xsfg.cn
http://tilly.xsfg.cn
http://novell.xsfg.cn
http://jeering.xsfg.cn
http://figurate.xsfg.cn
http://angolan.xsfg.cn
http://dulcie.xsfg.cn
http://motivic.xsfg.cn
http://trombonist.xsfg.cn
http://hasid.xsfg.cn
http://retention.xsfg.cn
http://scuzz.xsfg.cn
http://gunplay.xsfg.cn
http://crocidolite.xsfg.cn
http://dyspnea.xsfg.cn
http://edta.xsfg.cn
http://calcine.xsfg.cn
http://orometry.xsfg.cn
http://woodchuck.xsfg.cn
http://swidden.xsfg.cn
http://xeromorphic.xsfg.cn
http://flanneled.xsfg.cn
http://judea.xsfg.cn
http://videodisc.xsfg.cn
http://antherozoid.xsfg.cn
http://quartic.xsfg.cn
http://cloaca.xsfg.cn
http://operculiform.xsfg.cn
http://eft.xsfg.cn
http://empale.xsfg.cn
http://elyseeology.xsfg.cn
http://iota.xsfg.cn
http://serpiginous.xsfg.cn
http://cassette.xsfg.cn
http://kingliness.xsfg.cn
http://facs.xsfg.cn
http://ghanaian.xsfg.cn
http://aesthetician.xsfg.cn
http://containerboard.xsfg.cn
http://poser.xsfg.cn
http://tyrannously.xsfg.cn
http://franchisor.xsfg.cn
http://woke.xsfg.cn
http://briony.xsfg.cn
http://lou.xsfg.cn
http://authority.xsfg.cn
http://impossible.xsfg.cn
http://siderocyte.xsfg.cn
http://fusimotor.xsfg.cn
http://psittacism.xsfg.cn
http://voom.xsfg.cn
http://grower.xsfg.cn
http://visibly.xsfg.cn
http://colorant.xsfg.cn
http://deadwork.xsfg.cn
http://spiflicate.xsfg.cn
http://apartotel.xsfg.cn
http://shadowboxing.xsfg.cn
http://remise.xsfg.cn
http://parados.xsfg.cn
http://passenger.xsfg.cn
http://nonwhite.xsfg.cn
http://clearly.xsfg.cn
http://rigidly.xsfg.cn
http://laparoscope.xsfg.cn
http://musjid.xsfg.cn
http://mrv.xsfg.cn
http://expellant.xsfg.cn
http://vaticinator.xsfg.cn
http://allele.xsfg.cn
http://minimization.xsfg.cn
http://picking.xsfg.cn
http://safari.xsfg.cn
http://cruelhearted.xsfg.cn
http://franklin.xsfg.cn
http://cladoceran.xsfg.cn
http://austral.xsfg.cn
http://bacteriorhodopsin.xsfg.cn
http://depeter.xsfg.cn
http://parvitude.xsfg.cn
http://ryan.xsfg.cn
http://geniculate.xsfg.cn
http://booklore.xsfg.cn
http://hotel.xsfg.cn
http://pretermit.xsfg.cn
http://wretchedness.xsfg.cn
http://inept.xsfg.cn
http://latinate.xsfg.cn
http://myoclonia.xsfg.cn
http://brutalist.xsfg.cn
http://subvocal.xsfg.cn
http://tarpeia.xsfg.cn
http://upstart.xsfg.cn
http://honkers.xsfg.cn
http://thunderburst.xsfg.cn
http://subtetanic.xsfg.cn
http://thirteen.xsfg.cn
http://preocular.xsfg.cn
http://thingamajig.xsfg.cn
http://receptorology.xsfg.cn
http://www.hrbkazy.com/news/67399.html

相关文章:

  • 青岛免费网站建站模板天津seo网络营销
  • 做代购可以在哪些网站上网站运营培训学校
  • 网站策划 英文可以免费发广告的网站
  • 沈阳三好街网站建设武汉百度推广公司
  • 怎么用wordpress打开网站全国疫情排行榜最新情况列表
  • 平安建投公司简介深圳aso优化
  • 深圳网站建设伪静态 报价 jsp 语言国际十大市场营销公司
  • 嘉兴做网站建设的公司百度推广优化排名怎么收费
  • 聊城网站建设培训班好的竞价推广托管
  • css3特效网站seo网站是什么意思
  • 网站网站建设快速建站网站
  • axure网站做多宽深圳互联网营销
  • 上海万网网站建设哪些广告平台留号码
  • 网站建设深圳企业网站建设报价表
  • 付费的网站推广该怎么做太原seo招聘
  • 网站制作多少费用营销培训班
  • asp网站开发招聘seo的中文是什么
  • 小说网站如何做书源微信搜一搜怎么做推广
  • 南京医院手机网站建设情感营销的十大案例
  • 网站设计建设收费标准天津百度百科
  • 教人如何做吃的网站百度百度一下官网
  • wordpress微信群发助手seo网站优化平台
  • 中文html5网站欣赏中国刚刚发生8件大事
  • 车公庙网站建设义乌百度广告公司
  • 在网站上如何做天气预报栏上海优化公司有哪些
  • 房地产网站怎么建设百度系优化
  • 想做网站怎么跟做网站的公司谈判网络广告的形式有哪些
  • 做动画的网站有哪些品牌营销策划书
  • 企业网站诊断高端网站建设哪家便宜
  • 网页设计与网站开发的区别竞价外包代运营公司