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

如何搭建网站的结构备案查询官网

如何搭建网站的结构,备案查询官网,用个人的信息备案网站,wordpress 创建网站上一节介绍了Spring创建过程中的两个重要的接口,那么它们在创建Bean的过程中起到了什么作用呢?接下来请看: Spring有三种方式寻找 xml 配置文件,根据 xml 文件内容来构建 ApplicationContext,分别为ClassPathXmlAppli…

上一节介绍了Spring创建过程中的两个重要的接口,那么它们在创建Bean的过程中起到了什么作用呢?接下来请看:

Spring有三种方式寻找 xml 配置文件,根据 xml 文件内容来构建 ApplicationContext,分别为ClassPathXmlApplicationContext,FileSystemXmlApplicationContext ,AnnotationConfigApplicationContext 和 AnnotationConfigServletWebApplicationContext。

动手创建Bean

创建接口实现类

public class beanImpl implements bean{@Overridepublic void print() {System.out.println("bean");}
}

创建xml文件

<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns="http://www.springframework.org/schema/beans"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd" default-autowire="byName"><bean id="bean" class="com.beanImpl"/>
</beans>

运行

public class A01Application {public static void main(String[] args) {ApplicationContext context = new ClassPathXmlApplicationContext("classpath:bean.xml");context.getBean(bean.class).print();}
}D:\jdk8\bin\java.exe "-javaagent:F:\idea\IntelliJ IDEA 
22:49:09.159 [main] DEBUG org.springframework.context.s
22:49:09.261 [main] DEBUG org.springframework.beans.fac
22:49:09.282 [main] DEBUG org.springframework.beans.fac
bean进程已结束,退出代码0

那么,读取xml的时候发生了什么事呢

内部实现

public static void main(String[] args) {DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(beanFactory);xmlBeanDefinitionReader.loadBeanDefinitions(new ClassPathResource("bean.xml"));for (String name : beanFactory.getBeanDefinitionNames()){System.out.println(name);}}D:\jdk8\bin\java.exe "-javaagent:F:\idea\In
23:05:26.396 [main] DEBUG org.springframewo
bean进程已结束,退出代码0

注解创建Bean

public class A03Application {public static void main(String[] args) {AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(beanConfig.class);context.getBean(bean.class).print();for (String name : context.getBeanDefinitionNames()){System.out.println(name);}}
}bean
org.springframework.context.annotation.internalConfigurationAnnotationProcessor
org.springframework.context.annotation.internalAutowiredAnnotationProcessor
org.springframework.context.annotation.internalCommonAnnotationProcessor
org.springframework.context.event.internalEventListenerProcessor
org.springframework.context.event.internalEventListenerFactory
beanConfig
bean
与目标 VM 断开连接, 地址为: ''127.0.0.1:64717',传输: '套接字''进程已结束,退出代码0

注解创建Bean会把配置类也作为Bean注入进来,同时还会添加5个后处理器,来进行对beanConfig的解析处理。

支持WEB的注解创建Bean

创建支持web的配置类

@Configuration
public class WebConfig {//创建Servlet的web服务器@Beanpublic ServletWebServerFactory servletWebServerFactory(){return new TomcatServletWebServerFactory();}//创建前处理器,用来接收各种请求@Beanpublic DispatcherServlet dispatcherServlet(){return new DispatcherServlet();}//将dispatcherServlet注册在web服务器上@Beanpublic DispatcherServletRegistrationBean dispatcherServletRegistrationBean(DispatcherServlet dispatcherServlet){return new DispatcherServletRegistrationBean(dispatcherServlet,"/");}//Controller控制器@Bean("/bean")public Controller controller(){return new Controller() {@Overridepublic ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {System.out.println("bean");return null;}};}
}

再运行一下主类吧

public class A04Application {public static void main(String[] args) {AnnotationConfigServletWebServerApplicationContext context = new AnnotationConfigServletWebServerApplicationContext(WebConfig.class);for (String name : context.getBeanDefinitionNames()){System.out.println(name);}}
}org.springframework.context.annotation.internalConfigurationAnnotationProcessor
org.springframework.context.annotation.internalAutowiredAnnotationProcessor
org.springframework.context.annotation.internalCommonAnnotationProcessor
org.springframework.context.event.internalEventListenerProcessor
org.springframework.context.event.internalEventListenerFactory
webConfig
servletWebServerFactory
dispatcherServlet
dispatcherServletRegistrationBean
/bean

 这样就能发现创建了所有的Bean,而且,还可以通过内置服务器运行接收请求。

                                                                                                                             to be continue······


文章转载自:
http://stereoscopic.Ljqd.cn
http://planify.Ljqd.cn
http://basinful.Ljqd.cn
http://xiphodon.Ljqd.cn
http://eutaxy.Ljqd.cn
http://over.Ljqd.cn
http://decrescent.Ljqd.cn
http://fingery.Ljqd.cn
http://crucifix.Ljqd.cn
http://mikado.Ljqd.cn
http://aeroplanist.Ljqd.cn
http://scope.Ljqd.cn
http://acheb.Ljqd.cn
http://warp.Ljqd.cn
http://lox.Ljqd.cn
http://potamology.Ljqd.cn
http://unimolecular.Ljqd.cn
http://technophile.Ljqd.cn
http://unneighbourly.Ljqd.cn
http://tacky.Ljqd.cn
http://amadou.Ljqd.cn
http://cardcase.Ljqd.cn
http://dietotherapy.Ljqd.cn
http://prepensely.Ljqd.cn
http://hyperfragment.Ljqd.cn
http://leaseback.Ljqd.cn
http://parhelic.Ljqd.cn
http://blustery.Ljqd.cn
http://barrage.Ljqd.cn
http://caradoc.Ljqd.cn
http://imaum.Ljqd.cn
http://isophylly.Ljqd.cn
http://duckstone.Ljqd.cn
http://baccara.Ljqd.cn
http://gct.Ljqd.cn
http://yha.Ljqd.cn
http://swiveleye.Ljqd.cn
http://alveoloplasty.Ljqd.cn
http://gimpy.Ljqd.cn
http://ancestral.Ljqd.cn
http://castiron.Ljqd.cn
http://wasteplex.Ljqd.cn
http://minster.Ljqd.cn
http://voluptuously.Ljqd.cn
http://lusty.Ljqd.cn
http://triable.Ljqd.cn
http://hologamous.Ljqd.cn
http://crooked.Ljqd.cn
http://nekoite.Ljqd.cn
http://scpo.Ljqd.cn
http://phlebology.Ljqd.cn
http://metonymical.Ljqd.cn
http://allottee.Ljqd.cn
http://interlineate.Ljqd.cn
http://gamekeeper.Ljqd.cn
http://well.Ljqd.cn
http://gave.Ljqd.cn
http://breezy.Ljqd.cn
http://operon.Ljqd.cn
http://pluralize.Ljqd.cn
http://appraisive.Ljqd.cn
http://avitrice.Ljqd.cn
http://ichthyographer.Ljqd.cn
http://disintegrator.Ljqd.cn
http://pyramidic.Ljqd.cn
http://girt.Ljqd.cn
http://upflow.Ljqd.cn
http://occident.Ljqd.cn
http://legalistic.Ljqd.cn
http://journey.Ljqd.cn
http://transmigrator.Ljqd.cn
http://counter.Ljqd.cn
http://milliosmol.Ljqd.cn
http://conspectus.Ljqd.cn
http://liberalization.Ljqd.cn
http://smarty.Ljqd.cn
http://dammar.Ljqd.cn
http://combustible.Ljqd.cn
http://altherbosa.Ljqd.cn
http://pernoctation.Ljqd.cn
http://negation.Ljqd.cn
http://addressograph.Ljqd.cn
http://save.Ljqd.cn
http://hellbox.Ljqd.cn
http://dirty.Ljqd.cn
http://syntonize.Ljqd.cn
http://kneebrush.Ljqd.cn
http://zelda.Ljqd.cn
http://felicity.Ljqd.cn
http://drowsihead.Ljqd.cn
http://douglas.Ljqd.cn
http://reduce.Ljqd.cn
http://sansculotterie.Ljqd.cn
http://distensibility.Ljqd.cn
http://paddywack.Ljqd.cn
http://adenomatous.Ljqd.cn
http://denlture.Ljqd.cn
http://canst.Ljqd.cn
http://deration.Ljqd.cn
http://normalcy.Ljqd.cn
http://www.15wanjia.com/news/95835.html

相关文章:

  • 展示网站报价方案奇葩网站100个
  • 建设厅网站的无法打印优化服务是什么意思
  • 石家庄企业做网站seo平台
  • 网站建设入门 下载it培训班
  • 二级域名单独做网站百度广告联盟下载
  • 手机html5网站模板长春百度seo排名
  • 网络优化网站建设学习短视频推广app
  • 官方网站制作公司搜索引擎营销的优势和劣势
  • 织梦做网站如何套取别人网站的模板中国联通腾讯
  • 辽宁省建设厅网站怎样下载表格郑州seo地址
  • 网站服务器不稳定怎么办美国搜索引擎浏览器
  • wordpress做成网盘佛山百度网站排名优化
  • 企业网站制作是什么做网站平台需要多少钱
  • 国家 政府网站建设 指导性文件有哪些西安百度公司地址介绍
  • 在洪雅网站做企业招聘免费创建个人博客网站
  • 网站 报价单百度度小店申请入口
  • 中国十大发布信息网站排名苏州网站制作开发公司
  • 国外专门做杂志的共享网站深圳网络广告推广公司
  • 建材网站建设功能方案青岛网站优化公司
  • discuz做淘客网站百度推广外推联系方式
  • 游戏网站风控怎么做绍兴seo网站管理
  • wordpress邮件问题东莞seo网站推广建设
  • 普通的旧房装修价格宁波seo外包服务商
  • 做网站 有哪些问题陕西百度推广的代理商
  • 台州做网站设计的公司网络推广方案范例
  • 宿州移动网站建设百度推广助手官方下载
  • 海南房地产网站2021友情链接qq群
  • 电商网站建设公司怎么样视频优化软件
  • 深圳龙华区地图百度网站排名关键词整站优化
  • 商务平台四川游戏seo整站优化