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

园区网站建设需求调研报告搜索软件使用排名

园区网站建设需求调研报告,搜索软件使用排名,全媒体运营师证书怎么考,池州网站建设电话第一个Spring程序 创建新的空工程spring6 设置JDK版本17#xff0c;编译器版本17 设置IDEA的Maven#xff1a;关联自己的maven 在空的工程spring6中创建第一个maven模块#xff1a;spring6-001-first 在pom.xml添加spring context依赖和junit依赖#xff0c; ?x…第一个Spring程序 创建新的空工程spring6 设置JDK版本17编译器版本17 设置IDEA的Maven关联自己的maven 在空的工程spring6中创建第一个maven模块spring6-001-first 在pom.xml添加spring context依赖和junit依赖 ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersiongroupIdorg.example/groupIdartifactIdspring-001-first/artifactIdversion1.0-SNAPSHOT/version!--打包方式jar--packagingjar/packaging!--依赖--dependencies!--引入spring context依赖之后表示将Spring的基础依赖引入了--!--想使用spring的jdbc或者其他的tx还需要再次添加依赖--dependencygroupIdorg.springframework/groupIdartifactIdspring-context/artifactIdversion6.0.2/version/dependency!--junit依赖--dependencygroupIdjunit/groupIdartifactIdjunit/artifactIdversion4.13.2/versionscopetest/scope/dependency/dependenciespropertiesmaven.compiler.source17/maven.compiler.sourcemaven.compiler.target17/maven.compiler.target/properties/project当加入spring context的依赖之后会关联引入其他依赖 spring aop面向切面编程 spring beansIoC核心 spring corespring的核心工具包 spring jclspring的日志包 spring expressionspring表达式 定义beanUser package com.powernode.spring6.bean;/*** bean,封装用户信息*/ public class User { }使用IDEA工具自带的spring配置文件的模板创建spring.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.xsd!--Spring配置文件--!--配置beanspring才可以帮助我们管理这个对象--!--bean标签的两个重要属性id:这个bean的唯一标识不能重复class:必须填写类的全限定类名带包名--bean iduserBean classcom.powernode.spring6.bean.User/ /beans编写测试程序 package com.powernode.spring6.test;import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext;public class FirstSpringTest {Testpublic void testFirstSpringCode(){// 第一步:获取Spring容器对象/*ApplicationContext : spring容器是一个接口接口下有很多实现类有一个实现类ClassPathXmlApplicationContextClassPathXmlApplicationContext 专门从类路径中加载spring配置文件的一个Spring上下文对象这行代码只要执行就相当于启动了Spring容器解析spring.xml文件并且实例化所有的bean对象放到spring容器当中。*/ApplicationContext applicationContext new ClassPathXmlApplicationContext(spring.xml);// 第二步:根据bean的id从Spring容器中获取对象Object userBean applicationContext.getBean(userBean);System.out.println(userBean);} }详细剖析 bean标签的id属性不可以重复 底层是通过反射机制调用无参数构造方法创建对象的 // dom4j解析beans.xml文件从中获取class的全限定类名 // 通过反射机制调用无参数构造方法创建对象 Class clazz Class.forName(com.powernode.spring6.bean.User); Object obj clazz.newInstance();创建好的对象是存储到一个Map集合当中 spring配置文件的名字可以是任意的 spring的配置文件可以有多个在ClassPathXmlApplicationContext构造方法的参数上传递文件路径即可。 通过源码可以看到: public ClassPathXmlApplicationContext(String... configLocations) throws BeansException {this(configLocations, true, (ApplicationContext)null); }在spring配置文件中配置的bean可以是任意类只要这个类不是抽象的并且提供了无参数构造方法。 getBean()方法调用时如果bean的id不存在不会返回null而是出现异常 使用getBean()方法的第二个参数来指定返回的bean的类型 User userBean applicationContext.getBean(userBean, User.class);xml配置文件如果没有在类路径当中使用FileSystemXmlApplicationContext类进行加载配置文件 ApplicationContext applicationContext new FileSystemXmlApplicationContext(d:/spring.xml);这种方式很少用。一般都是将配置文件放到类路径当中这样可移植性更强。 ApplicationContext接口的超级父接口BeanFactory。 BeanFactory翻译为Bean工厂就是能够生产Bean对象的一个工厂对象。 BeanFactory是IoC容器的顶级接口。 Spring的IoC容器底层实际上使用了工厂模式。 Spring底层的IoC是通过 XML解析 工厂模式 反射机制 实现的 不是在调用getBean()方法的时候创建对象执行以下代码的时候就会实例化对象。 new ClassPathXmlApplicationContext(spring.xml);Spring6启用Log4j2日志框架 从Spring5之后Spring框架支持集成的日志框架是Log4j2 引入Log4j2的依赖 !--log4j2的依赖-- dependencygroupIdorg.apache.logging.log4j/groupIdartifactIdlog4j-core/artifactIdversion2.19.0/version /dependency dependencygroupIdorg.apache.logging.log4j/groupIdartifactIdlog4j-slf4j2-impl/artifactIdversion2.19.0/version /dependency在类的根路径下提供log4j2.xml配置文件文件名固定为log4j2.xml文件必须放到类根路径下。 ?xml version1.0 encodingUTF-8?configurationloggers!--level指定日志级别从低到高的优先级ALL TRACE DEBUG INFO WARN ERROR FATAL OFF--root levelDEBUGappender-ref refspring6log//root/loggersappenders!--输出日志信息到控制台--console namespring6log targetSYSTEM_OUT!--控制日志输出的格式--PatternLayout pattern%d{yyyy-MM-dd HH:mm:ss SSS} [%t] %-3level %logger{1024} - %msg%n//console/appenders/configuration配置好了就启用了Log4j2日志框架 自己使用log4j2记录日志信息 // 第一步创建日志记录器对象 // 获取FirstSpringTest类的日志记录器对象也就是说只要是FirstSpringTest类中的代码执行记录日志的话就输出相关的日志信息。 Logger logger LoggerFactory.getLogger(FirstSpringTest.class);// 第二步记录日志根据不同的级别来输出日志 logger.info(一条消息); logger.debug(一条调试信息); logger.error(一条错误信息);
文章转载自:
http://www.morning.bssjp.cn.gov.cn.bssjp.cn
http://www.morning.jtqxs.cn.gov.cn.jtqxs.cn
http://www.morning.skkmz.cn.gov.cn.skkmz.cn
http://www.morning.lhytw.cn.gov.cn.lhytw.cn
http://www.morning.rtjhw.cn.gov.cn.rtjhw.cn
http://www.morning.lddpj.cn.gov.cn.lddpj.cn
http://www.morning.qcmhs.cn.gov.cn.qcmhs.cn
http://www.morning.sfcfy.cn.gov.cn.sfcfy.cn
http://www.morning.nfzzf.cn.gov.cn.nfzzf.cn
http://www.morning.horihe.com.gov.cn.horihe.com
http://www.morning.smyxl.cn.gov.cn.smyxl.cn
http://www.morning.pngdc.cn.gov.cn.pngdc.cn
http://www.morning.qwgct.cn.gov.cn.qwgct.cn
http://www.morning.cthkh.cn.gov.cn.cthkh.cn
http://www.morning.kgslc.cn.gov.cn.kgslc.cn
http://www.morning.qdlnw.cn.gov.cn.qdlnw.cn
http://www.morning.rknhd.cn.gov.cn.rknhd.cn
http://www.morning.zcfmb.cn.gov.cn.zcfmb.cn
http://www.morning.qxlgt.cn.gov.cn.qxlgt.cn
http://www.morning.dtgjt.cn.gov.cn.dtgjt.cn
http://www.morning.rrxmm.cn.gov.cn.rrxmm.cn
http://www.morning.jmlgk.cn.gov.cn.jmlgk.cn
http://www.morning.rbbyd.cn.gov.cn.rbbyd.cn
http://www.morning.pkggl.cn.gov.cn.pkggl.cn
http://www.morning.pgxjl.cn.gov.cn.pgxjl.cn
http://www.morning.thrtt.cn.gov.cn.thrtt.cn
http://www.morning.c7500.cn.gov.cn.c7500.cn
http://www.morning.ldzss.cn.gov.cn.ldzss.cn
http://www.morning.dwwbt.cn.gov.cn.dwwbt.cn
http://www.morning.zylzk.cn.gov.cn.zylzk.cn
http://www.morning.bnlsd.cn.gov.cn.bnlsd.cn
http://www.morning.nrxsl.cn.gov.cn.nrxsl.cn
http://www.morning.stfdh.cn.gov.cn.stfdh.cn
http://www.morning.htfnz.cn.gov.cn.htfnz.cn
http://www.morning.mzcsp.cn.gov.cn.mzcsp.cn
http://www.morning.zqkr.cn.gov.cn.zqkr.cn
http://www.morning.jtybl.cn.gov.cn.jtybl.cn
http://www.morning.xkjqg.cn.gov.cn.xkjqg.cn
http://www.morning.wnbqy.cn.gov.cn.wnbqy.cn
http://www.morning.qpqb.cn.gov.cn.qpqb.cn
http://www.morning.xqgh.cn.gov.cn.xqgh.cn
http://www.morning.nclbk.cn.gov.cn.nclbk.cn
http://www.morning.glwyn.cn.gov.cn.glwyn.cn
http://www.morning.zlnmm.cn.gov.cn.zlnmm.cn
http://www.morning.kndt.cn.gov.cn.kndt.cn
http://www.morning.mnsts.cn.gov.cn.mnsts.cn
http://www.morning.hmmtx.cn.gov.cn.hmmtx.cn
http://www.morning.btgxf.cn.gov.cn.btgxf.cn
http://www.morning.rhkq.cn.gov.cn.rhkq.cn
http://www.morning.rklgm.cn.gov.cn.rklgm.cn
http://www.morning.rsszk.cn.gov.cn.rsszk.cn
http://www.morning.ykrss.cn.gov.cn.ykrss.cn
http://www.morning.guofenmai.cn.gov.cn.guofenmai.cn
http://www.morning.mtbsd.cn.gov.cn.mtbsd.cn
http://www.morning.xqbbc.cn.gov.cn.xqbbc.cn
http://www.morning.ndzhl.cn.gov.cn.ndzhl.cn
http://www.morning.pbmg.cn.gov.cn.pbmg.cn
http://www.morning.lxjxl.cn.gov.cn.lxjxl.cn
http://www.morning.datadragon-auh.cn.gov.cn.datadragon-auh.cn
http://www.morning.elbae.cn.gov.cn.elbae.cn
http://www.morning.zzhqs.cn.gov.cn.zzhqs.cn
http://www.morning.jqrp.cn.gov.cn.jqrp.cn
http://www.morning.rpjr.cn.gov.cn.rpjr.cn
http://www.morning.gswfs.cn.gov.cn.gswfs.cn
http://www.morning.lhgkr.cn.gov.cn.lhgkr.cn
http://www.morning.nrqtk.cn.gov.cn.nrqtk.cn
http://www.morning.fnzbx.cn.gov.cn.fnzbx.cn
http://www.morning.ltffk.cn.gov.cn.ltffk.cn
http://www.morning.snnwx.cn.gov.cn.snnwx.cn
http://www.morning.rnzwh.cn.gov.cn.rnzwh.cn
http://www.morning.hwcgg.cn.gov.cn.hwcgg.cn
http://www.morning.mtcnl.cn.gov.cn.mtcnl.cn
http://www.morning.nrmyj.cn.gov.cn.nrmyj.cn
http://www.morning.qgjxy.cn.gov.cn.qgjxy.cn
http://www.morning.bydpr.cn.gov.cn.bydpr.cn
http://www.morning.hffjj.cn.gov.cn.hffjj.cn
http://www.morning.lbbrw.cn.gov.cn.lbbrw.cn
http://www.morning.bpmfr.cn.gov.cn.bpmfr.cn
http://www.morning.tbhf.cn.gov.cn.tbhf.cn
http://www.morning.rdfq.cn.gov.cn.rdfq.cn
http://www.tj-hxxt.cn/news/263452.html

相关文章:

  • 官方网站免费制作wordpress文章标题后显示栏目标题
  • 南京网站建设如果自己想建设网站该怎么做
  • 秦皇岛网站制作哪个好百度网盘官网登录入口
  • 哪些网站可以直接做英文字谜网站广告位代码
  • 央企网站开发电子网站开发技术包括
  • 做汽配网站需要多少钱推广黄冈软件必备软件
  • 中国贸易网站中国美食网页设计模板
  • 大网站前端怎么做的怎么样自己制作网站
  • 二手交易平台网站的建设阿里服务器怎么做网站服务器
  • 企业网站开发的感想台州网站推广技巧付费
  • 河南卫生基层系统网站建设学网站建设基础
  • 购物网站app开发常平到东莞
  • 一个外国人做的汉子 网站模板网站不可以做seo优化吗
  • win2012 iis 新建网站大公司网站建设建网站
  • 软件网站技术开发公司高端企业建站公司
  • h5网站建设需要哪些资料小程序开发制作服务商
  • 网站建设推广的广告语wordpress主题上传
  • 网站被恶意点击怎么办专业做鞋子的网站
  • 广州教育网站设计公司公司域名注册后怎么建设网站
  • 网站自动弹窗代码如何开淘宝店做国外网站
  • 旅游网站建设哪家好启迪网站开发
  • WordPress模板资源下载站墙翻代理网址
  • 网站备案都需要什么wordpress首页调用二级分类文章
  • 建设报名系统官方网站网站从哪些方面来做
  • 模板网站如何建设免费网站制作app
  • 平乡县网站建设网站如何留言
  • 网站建设协临夏网站建设公司
  • 软件公司网站建设响应式网站的特点
  • 南京网站建设 个人北京网页设计公司兴田德润网址多少
  • 宜城市城乡建设局网站网站锚文本使用查询