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

长春做网站网站百度seo最新算法

长春做网站网站,百度seo最新算法,腾讯云做网站怎么样,数据分析对网站建设的重要性首先#xff0c;在xml其中新增部分标有下划线的文件#xff0c;容器初始化的时候需要扫描包 注意#xff1a; a. 包款扫描(下划线部分)一定要加#xff0c;默认是不扫描整个包。与每一包之间’#xff0c;’开。如过具有同样的父包#xff0c;那么我们能够用父包来取… 首先在xml其中新增部分标有下划线的文件容器初始化的时候需要扫描包  注意 a.     包款扫描(下划线部分)一定要加默认是不扫描整个包。与每一包之间’’开。如过具有同样的父包那么我们能够用父包来取代。例如以下划线部分我们能够用com.bjsxt来取代。 ?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beans xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance xmlns:contexthttp://www.springframework.org/schema/context xsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd context:annotation-config /!-- 自己主动装配一定要 加上此片段-- context:component-scan base-packagecom.bjsxt.dao.impl,com.bjsxt.service,com.bjsxt.model/context:component-scan /beans b.     在2.5版本号中(Component、Repository、Service和Controller)四个标签代表同样的含义以后的版本号中可能会有差别。 c.    在标注组件等资源时候尽量加上名称比如Component(stuDaoImpl)。默认的名称是 类名首字母小写。 pre namecode classjavapackage com.bjsxt.dao.impl; import javax.annotation.Resource; import org.springframework.stereotype.Component; import com.bjsxt.dao.*; import com.bjsxt.model.Student; Component(stuDaoImpl) public class StudentDaoImpl implements StudentDao{Overridepublic void StudentSave(Student s) {System.out.println(学生被保存);} } d.      用法 在set方法或者属性名前增加 resource(namestuDaoImpl)推荐增加名称默认是依照类型进行查找。比如 import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component;import com.bjsxt.dao.*; import com.bjsxt.dao.impl.*; import com.bjsxt.model.*; Component(studentService)//声明资源 public class StudentService { private StudentDao studentDao; public StudentDao getStudentDao() {return studentDao; } Resource(namestuDaoImpl)//注入 public void setStudentDao(StudentDao studentDao) {this.studentDao studentDao; } public void add(Student s) {this.studentDao.StudentSave(s); }e.測试方式依旧和之前的注入方式一样注意这里的 Studentstudent(Student)ctx.getBean(student);是我们用标签在student类中声明的Component(student)。Spring容器会能通过ctx(相当于beanFactory)找到。 package com.bjsxt.service;import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext;import com.bjsxt.model.Student;public class StudentServiceTest {Testpublic void test() {System.out.println(程序执行之前....);ApplicationContext ctxnew ClassPathXmlApplicationContext(beans.xml);System.out.println(程序执行開始....);StudentService sService(StudentService)ctx.getBean(studentService);Student student(Student)ctx.getBean(student);Student student2(Student)ctx.getBean(student);System.out.println(student2student);sService.add(student);} }f.   在jsp页面须要处理业务有java代码须要spring注入service。 须要如今想要获取的类前加标签 Component(docrelationService)首先jsp页面导入 %page importorg.springframework.context.ApplicationContext% %pageimportorg.springframework.web.context.support.WebApplicationContextUtils% 获取spring注入 %         ApplicationContext context WebApplicationContextUtils              .getWebApplicationContext(application);            DocrelationServicedocrelationService (DocrelationService) context              .getBean(docrelationService); % g.    假如类A由spring容器管理,在类B中引用A,假设想在B中的A是由spring容器创建的,有两种方法:      a).类B也由spring容器管理(即类B前有compoment(“b”)标签),并注入A,用BeanFactory.getBean(b) 得到B实例,就可以(推荐).      b).类B不由spring容器管理,在类B中用代码 ABeanFactory.getBean(a)得到A实例,就可以.不推荐会产生两个beanFactory由于在类B中须要用BeanFactory,所以我们必须在B中new一个 c)类B创建实例时候假设採用a方法决不能採用B bnew B();的方式否则会报nullpoint异常。 d)ClassPathXmlApplicationContext建立在beanFactory基础之上非常少有人直接使用。 測试代码 package com.bjsxt.service;import org.junit.Test; import org.springframework.beans.factory.BeanFactory; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext;import com.bjsxt.model.Student;public class StudentServiceTest {Testpublic void test() {System.out.println(程序执行之前....);//BeanFactory ctxnew ClassPathXmlApplicationContext(beans.xml);//ClassPathXmlApplicationContext建立在beanFactory基础之上非常少有人直接使用。 ApplicationContext ctxnew ClassPathXmlApplicationContext(beans.xml);//直接获取spring容器 System.out.println(程序执行開始....); StudentService sService(StudentService)ctx.getBean(studentService);//StudentService相当于类B //StudentService sServicenew StudentService(); Student student(Student)ctx.getBean(student); Student student2(Student)ctx.getBean(student); System.out.println(student2student); sService.add(student); } } 版权声明本文博客原创文章博客未经同意不得转载。 转载于:https://www.cnblogs.com/zfyouxi/p/4640478.html
http://www.zqtcl.cn/news/94347/

相关文章:

  • 做网站里面的图片像素要求安徽 网站建设
  • 电子商务推广网站wordpress小程序搭建
  • 张家港网站开发培训广告代理那些平台可以给网站做外链
  • 搞一个公司网站得多少钱中国航天空间站最新消息
  • php移动网站开发微商做图王官方网站
  • 制作网站中英文字体不能为网页设计与制作教程试题
  • 网站建设与管理案例柳洪轶wordpress学校站模板
  • 湖北省和住房建设厅官方网站自媒体专业
  • 榆林网站开发自己建设购物网站
  • 新材建设局网站百度提问首页
  • 网站优化网站建设栅格布局 网站设计
  • 网站建设销售前景网站手机开
  • 网站建站 用户注册北京网站建设方案报价
  • jsp做网站 案例网站模板 招聘
  • 德州建设银行兑换网站服务器网站跳转怎么做的
  • 金华专业做网站公司湖南网站建设服务
  • 企业网站设计沈阳苏宁电器网站建设特点分析
  • 建设工程类公司网站易语言可以做api网站对接吗
  • 青岛做网站皆赴青岛博wordpress 数据库 备份
  • 外贸公司网站空间哈尔滨seo优化专注
  • 建筑行业综合查询平台优化推广联盟
  • 北京管庄网站建设公司开平网站制作
  • 如何做销售直播网站最专业网站建设
  • 太原市住房和城乡建设局的网站首页网络推广服务外包公司
  • 湘icp备 网站建设 农业 湖南稿定设计免费版
  • 公司网站推广方法陕西省住房建设厅官网
  • 网站关键词排名突然没了无锡企业网站建设报价
  • 找做网站的人网站改版 301跳转
  • 网站备案一次就可以了吧营销管理培训课程
  • 怎么做网站背景专做民宿预定的网站