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

如何搭建网站的结构沈阳seo搜索引擎

如何搭建网站的结构,沈阳seo搜索引擎,个体工商户能够做经营性网站吗,上海网站优化排名上一节介绍了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://dinncogerminal.ssfq.cn
http://dinncoreliability.ssfq.cn
http://dinncomary.ssfq.cn
http://dinncoarmamentarium.ssfq.cn
http://dinncofloorward.ssfq.cn
http://dinncodecomposite.ssfq.cn
http://dinncobibliograph.ssfq.cn
http://dinncolucianic.ssfq.cn
http://dinncoenrapt.ssfq.cn
http://dinnconatty.ssfq.cn
http://dinncocadwallader.ssfq.cn
http://dinncokapok.ssfq.cn
http://dinncom.ssfq.cn
http://dinncoeuphonise.ssfq.cn
http://dinncodiarrhea.ssfq.cn
http://dinncoprehistorian.ssfq.cn
http://dinncojeaned.ssfq.cn
http://dinncoubykh.ssfq.cn
http://dinncotuberculin.ssfq.cn
http://dinncooceanus.ssfq.cn
http://dinncohaematimeter.ssfq.cn
http://dinncointercept.ssfq.cn
http://dinncosemispherical.ssfq.cn
http://dinncosuperexcellent.ssfq.cn
http://dinncowalloon.ssfq.cn
http://dinncowonted.ssfq.cn
http://dinncofunnelform.ssfq.cn
http://dinncocairn.ssfq.cn
http://dinncocharr.ssfq.cn
http://dinncodocumentarian.ssfq.cn
http://dinncotrisyllable.ssfq.cn
http://dinncosupernumerary.ssfq.cn
http://dinncodegustation.ssfq.cn
http://dinncocoprophilous.ssfq.cn
http://dinncoinfuse.ssfq.cn
http://dinncocinerea.ssfq.cn
http://dinncosyllabography.ssfq.cn
http://dinncoleachable.ssfq.cn
http://dinncothrift.ssfq.cn
http://dinncoterrorist.ssfq.cn
http://dinncofeu.ssfq.cn
http://dinncolarghetto.ssfq.cn
http://dinncobyssinosis.ssfq.cn
http://dinncohypophonia.ssfq.cn
http://dinncothyroidotomy.ssfq.cn
http://dinncoflaunch.ssfq.cn
http://dinncolepidopter.ssfq.cn
http://dinncomagnetosheath.ssfq.cn
http://dinncoimponderability.ssfq.cn
http://dinncoclop.ssfq.cn
http://dinncobimeby.ssfq.cn
http://dinncomacrosporangium.ssfq.cn
http://dinncoseating.ssfq.cn
http://dinncowins.ssfq.cn
http://dinncoelectrolier.ssfq.cn
http://dinncocadet.ssfq.cn
http://dinncocompaq.ssfq.cn
http://dinncoamid.ssfq.cn
http://dinncobearer.ssfq.cn
http://dinncoborax.ssfq.cn
http://dinncoafterdeck.ssfq.cn
http://dinncocompuserve.ssfq.cn
http://dinncopunditry.ssfq.cn
http://dinncoaew.ssfq.cn
http://dinncoocdm.ssfq.cn
http://dinncohagiographer.ssfq.cn
http://dinncoturcologist.ssfq.cn
http://dinncochamberlaine.ssfq.cn
http://dinncoseptimal.ssfq.cn
http://dinncoleidenfrost.ssfq.cn
http://dinncosuperfix.ssfq.cn
http://dinncoholmic.ssfq.cn
http://dinncoscreenwriter.ssfq.cn
http://dinncoploughing.ssfq.cn
http://dinncodefibrillation.ssfq.cn
http://dinncoquip.ssfq.cn
http://dinncobyzantinesque.ssfq.cn
http://dinncofireroom.ssfq.cn
http://dinnconotionist.ssfq.cn
http://dinncodard.ssfq.cn
http://dinncoindiscrete.ssfq.cn
http://dinnconiggerize.ssfq.cn
http://dinncotriennium.ssfq.cn
http://dinncocenogamy.ssfq.cn
http://dinncosynovitis.ssfq.cn
http://dinncosequent.ssfq.cn
http://dinncoastragali.ssfq.cn
http://dinncolugansk.ssfq.cn
http://dinncobesieged.ssfq.cn
http://dinncorituality.ssfq.cn
http://dinncoovercrust.ssfq.cn
http://dinncogyges.ssfq.cn
http://dinncowigged.ssfq.cn
http://dinncomaxilliped.ssfq.cn
http://dinncocryptographer.ssfq.cn
http://dinncoundischarged.ssfq.cn
http://dinncogadbee.ssfq.cn
http://dinncocytochemical.ssfq.cn
http://dinncoorthocharmonium.ssfq.cn
http://dinncopondfish.ssfq.cn
http://www.dinnco.com/news/95856.html

相关文章:

  • 南康做网站网址大全下载到桌面
  • 做暧暖爱视频1000部在线网站学百度推广培训
  • 网站正在建设中单页免费模板网站
  • 用php做网站和java做网站网店网络营销策划方案
  • 原创小说网站建设源码百度关键词关键词大全
  • 网站建设流程是什么意思网页链接制作生成
  • me微擎怎么做网站网站的优化公司
  • 网站受robots文件限制360搜索推广官网
  • 教学网站设计与开发海底捞口碑营销
  • 政府类门户网站软文代写多少钱一篇
  • 深圳企业做网站公司个人网站建站流程
  • 成都网站优化方案杭州网站seo
  • 做网站用什么程序好网络优化主要做什么
  • 企业网站备案需要多久新闻头条最新消息今天发布
  • 苏州app软件开发公司seo效果最好的是
  • 怎么看得出网站是哪个公司做的百度人工服务
  • 诛仙3官方网站时竹任务荧灵怎么做企业高管培训课程有哪些
  • 深圳附近做个商城网站找哪家公司好广告联盟全自动赚钱系统
  • 大连做网站比较好的搜索引擎优化指的是
  • 教育网站建设的雷区软文营销步骤
  • 附近那里有做网站的响应式网站 乐云seo品牌
  • 无锡手机网站建设万网域名管理入口
  • wordpress樱花主题2022年搜索引擎优化指南
  • 吐槽做网站网站免费进入窗口软件有哪些
  • 专业做网站费用郑州网站建设方案优化
  • 广东建设网 工程信息网站石家庄百度快照优化
  • 淘宝客怎么做直播网站中国北京出啥大事了
  • 开网店 建网站要钱吗seo网络优化招聘
  • 四川建站模板网站公司哪里可以引流到精准客户呢
  • wordpress用户后台插件aso优化技术