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

个人网站怎么做推广wordpress4.9.6 漏洞

个人网站怎么做推广,wordpress4.9.6 漏洞,网站代码输入完成之后要怎么做,公司做网站的好处学习的最大理由是想摆脱平庸#xff0c;早一天就多一份人生的精彩#xff1b;迟一天就多一天平庸的困扰。各位小伙伴#xff0c;如果您#xff1a; 想系统/深入学习某技术知识点… 一个人摸索学习很难坚持#xff0c;想组团高效学习… 想写博客但无从下手#xff0c;急需… 学习的最大理由是想摆脱平庸早一天就多一份人生的精彩迟一天就多一天平庸的困扰。各位小伙伴如果您 想系统/深入学习某技术知识点… 一个人摸索学习很难坚持想组团高效学习… 想写博客但无从下手急需写作干货注入能量… 热爱写作愿意让自己成为更好的人… 文章目录 前言11、实验十bean的作用域12、实验十一bean生命周期13、实验十二FactoryBean14、实验十三基于xml自动装配 总结 前言 11、实验十bean的作用域 12、实验十一bean生命周期 13、实验十二FactoryBean 14、实验十三基于xml自动装配 11、实验十bean的作用域 ①概念 在Spring中可以通过配置bean标签的scope属性来指定bean的作用域范围各取值含义参加下表 取值含义创建对象的时机singleton默认在IOC容器中这个bean的对象始终为单实例IOC容器初始化时prototype这个bean在IOC容器中有多个实例获取bean时 如果是在WebApplicationContext环境下还会有另外几个作用域但不常用 取值含义request在一个请求范围内有效session在一个会话范围内有效 ②创建类User package com.atguigu.spring6.bean; public class User {private Integer id;private String username;private String password;private Integer age;public User() {}public User(Integer id, String username, String password, Integer age) {this.id id;this.username username;this.password password;this.age age;}public Integer getId() {return id;}public void setId(Integer id) {this.id id;}public String getUsername() {return username;}public void setUsername(String username) {this.username username;}public String getPassword() {return password;}public void setPassword(String password) {this.password password;}public Integer getAge() {return age;}public void setAge(Integer age) {this.age age;}Overridepublic String toString() {return User{ id id , username username \ , password password \ , age age };} }③配置bean !-- scope属性取值singleton默认值bean在IOC容器中只有一个实例IOC容器初始化时创建对象 -- !-- scope属性取值prototypebean在IOC容器中可以有多个实例getBean()时创建对象 -- bean classcom.atguigu.spring6.bean.User scopeprototype/bean④测试 Test public void testBeanScope(){ApplicationContext ac new ClassPathXmlApplicationContext(spring-scope.xml);User user1 ac.getBean(User.class);User user2 ac.getBean(User.class);System.out.println(user1user2); }12、实验十一bean生命周期 ①具体的生命周期过程 bean对象创建调用无参构造器 给bean对象设置属性 bean的后置处理器初始化之前 bean对象初始化需在配置bean时指定初始化方法 bean的后置处理器初始化之后 bean对象就绪可以使用 bean对象销毁需在配置bean时指定销毁方法 IOC容器关闭 ②修改类User public class User {private Integer id;private String username;private String password;private Integer age;public User() {System.out.println(生命周期1、创建对象);}public User(Integer id, String username, String password, Integer age) {this.id id;this.username username;this.password password;this.age age;}public Integer getId() {return id;}public void setId(Integer id) {System.out.println(生命周期2、依赖注入);this.id id;}public String getUsername() {return username;}public void setUsername(String username) {this.username username;}public String getPassword() {return password;}public void setPassword(String password) {this.password password;}public Integer getAge() {return age;}public void setAge(Integer age) {this.age age;}public void initMethod(){System.out.println(生命周期3、初始化);}public void destroyMethod(){System.out.println(生命周期5、销毁);}Overridepublic String toString() {return User{ id id , username username \ , password password \ , age age };} }注意其中的initMethod()和destroyMethod()可以通过配置bean指定为初始化和销毁的方法 ③配置bean !-- 使用init-method属性指定初始化方法 -- !-- 使用destroy-method属性指定销毁方法 -- bean classcom.atguigu.spring6.bean.User scopeprototype init-methodinitMethod destroy-methoddestroyMethodproperty nameid value1001/propertyproperty nameusername valueadmin/propertyproperty namepassword value123456/propertyproperty nameage value23/property /bean④测试 Test public void testLife(){ClassPathXmlApplicationContext ac new ClassPathXmlApplicationContext(spring-lifecycle.xml);User bean ac.getBean(User.class);System.out.println(生命周期4、通过IOC容器获取bean并使用);ac.close(); }⑤bean的后置处理器 bean的后置处理器会在生命周期的初始化前后添加额外的操作需要实现BeanPostProcessor接口且配置到IOC容器中需要注意的是bean后置处理器不是单独针对某一个bean生效而是针对IOC容器中所有bean都会执行 创建bean的后置处理器 package com.atguigu.spring6.process;import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanPostProcessor;public class MyBeanProcessor implements BeanPostProcessor {Overridepublic Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {System.out.println(☆☆☆ beanName bean);return bean;}Overridepublic Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {System.out.println(★★★ beanName bean);return bean;} }在IOC容器中配置后置处理器 !-- bean的后置处理器要放入IOC容器才能生效 -- bean idmyBeanProcessor classcom.atguigu.spring6.process.MyBeanProcessor/13、实验十二FactoryBean ①简介 FactoryBean是Spring提供的一种整合第三方框架的常用机制。和普通的bean不同配置一个FactoryBean类型的bean在获取bean的时候得到的并不是class属性中配置的这个类的对象而是getObject()方法的返回值。通过这种机制Spring可以帮我们把复杂组件创建的详细过程和繁琐细节都屏蔽起来只把最简洁的使用界面展示给我们。 将来我们整合Mybatis时Spring就是通过FactoryBean机制来帮我们创建SqlSessionFactory对象的。 /** Copyright 2002-2020 the original author or authors.** Licensed under the Apache License, Version 2.0 (the License);* you may not use this file except in compliance with the License.* You may obtain a copy of the License at** https://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an AS IS BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/ package org.springframework.beans.factory;import org.springframework.lang.Nullable;/*** Interface to be implemented by objects used within a {link BeanFactory} which* are themselves factories for individual objects. If a bean implements this* interface, it is used as a factory for an object to expose, not directly as a* bean instance that will be exposed itself.** pbNB: A bean that implements this interface cannot be used as a normal bean./b* A FactoryBean is defined in a bean style, but the object exposed for bean* references ({link #getObject()}) is always the object that it creates.** pFactoryBeans can support singletons and prototypes, and can either create* objects lazily on demand or eagerly on startup. The {link SmartFactoryBean}* interface allows for exposing more fine-grained behavioral metadata.** pThis interface is heavily used within the framework itself, for example for* the AOP {link org.springframework.aop.framework.ProxyFactoryBean} or the* {link org.springframework.jndi.JndiObjectFactoryBean}. It can be used for* custom components as well; however, this is only common for infrastructure code.** pb{code FactoryBean} is a programmatic contract. Implementations are not* supposed to rely on annotation-driven injection or other reflective facilities./b* {link #getObjectType()} {link #getObject()} invocations may arrive early in the* bootstrap process, even ahead of any post-processor setup. If you need access to* other beans, implement {link BeanFactoryAware} and obtain them programmatically.** pbThe container is only responsible for managing the lifecycle of the FactoryBean* instance, not the lifecycle of the objects created by the FactoryBean./b Therefore,* a destroy method on an exposed bean object (such as {link java.io.Closeable#close()}* will inot/i be called automatically. Instead, a FactoryBean should implement* {link DisposableBean} and delegate any such close call to the underlying object.** pFinally, FactoryBean objects participate in the containing BeanFactorys* synchronization of bean creation. There is usually no need for internal* synchronization other than for purposes of lazy initialization within the* FactoryBean itself (or the like).** author Rod Johnson* author Juergen Hoeller* since 08.03.2003* param T the bean type* see org.springframework.beans.factory.BeanFactory* see org.springframework.aop.framework.ProxyFactoryBean* see org.springframework.jndi.JndiObjectFactoryBean*/ public interface FactoryBeanT {/*** The name of an attribute that can be* {link org.springframework.core.AttributeAccessor#setAttribute set} on a* {link org.springframework.beans.factory.config.BeanDefinition} so that* factory beans can signal their object type when it cant be deduced from* the factory bean class.* since 5.2*/String OBJECT_TYPE_ATTRIBUTE factoryBeanObjectType;/*** Return an instance (possibly shared or independent) of the object* managed by this factory.* pAs with a {link BeanFactory}, this allows support for both the* Singleton and Prototype design pattern.* pIf this FactoryBean is not fully initialized yet at the time of* the call (for example because it is involved in a circular reference),* throw a corresponding {link FactoryBeanNotInitializedException}.* pAs of Spring 2.0, FactoryBeans are allowed to return {code null}* objects. The factory will consider this as normal value to be used; it* will not throw a FactoryBeanNotInitializedException in this case anymore.* FactoryBean implementations are encouraged to throw* FactoryBeanNotInitializedException themselves now, as appropriate.* return an instance of the bean (can be {code null})* throws Exception in case of creation errors* see FactoryBeanNotInitializedException*/NullableT getObject() throws Exception;/*** Return the type of object that this FactoryBean creates,* or {code null} if not known in advance.* pThis allows one to check for specific types of beans without* instantiating objects, for example on autowiring.* pIn the case of implementations that are creating a singleton object,* this method should try to avoid singleton creation as far as possible;* it should rather estimate the type in advance.* For prototypes, returning a meaningful type here is advisable too.* pThis method can be called ibefore/i this FactoryBean has* been fully initialized. It must not rely on state created during* initialization; of course, it can still use such state if available.* pbNOTE:/b Autowiring will simply ignore FactoryBeans that return* {code null} here. Therefore it is highly recommended to implement* this method properly, using the current state of the FactoryBean.* return the type of object that this FactoryBean creates,* or {code null} if not known at the time of the call* see ListableBeanFactory#getBeansOfType*/NullableClass? getObjectType();/*** Is the object managed by this factory a singleton? That is,* will {link #getObject()} always return the same object* (a reference that can be cached)?* pbNOTE:/b If a FactoryBean indicates to hold a singleton object,* the object returned from {code getObject()} might get cached* by the owning BeanFactory. Hence, do not return {code true}* unless the FactoryBean always exposes the same reference.* pThe singleton status of the FactoryBean itself will generally* be provided by the owning BeanFactory; usually, it has to be* defined as singleton there.* pbNOTE:/b This method returning {code false} does not* necessarily indicate that returned objects are independent instances.* An implementation of the extended {link SmartFactoryBean} interface* may explicitly indicate independent instances through its* {link SmartFactoryBean#isPrototype()} method. Plain {link FactoryBean}* implementations which do not implement this extended interface are* simply assumed to always return independent instances if the* {code isSingleton()} implementation returns {code false}.* pThe default implementation returns {code true}, since a* {code FactoryBean} typically manages a singleton instance.* return whether the exposed object is a singleton* see #getObject()* see SmartFactoryBean#isPrototype()*/default boolean isSingleton() {return true;} }②创建类UserFactoryBean package com.atguigu.spring6.bean; public class UserFactoryBean implements FactoryBeanUser {Overridepublic User getObject() throws Exception {return new User();}Overridepublic Class? getObjectType() {return User.class;} }③配置bean bean iduser classcom.atguigu.spring6.bean.UserFactoryBean/bean④测试 Test public void testUserFactoryBean(){//获取IOC容器ApplicationContext ac new ClassPathXmlApplicationContext(spring-factorybean.xml);User user (User) ac.getBean(user);System.out.println(user); }14、实验十三基于xml自动装配 自动装配 根据指定的策略在IOC容器中匹配某一个bean自动为指定的bean中所依赖的类类型或接口类型属性赋值 ①场景模拟 创建类UserController package com.atguigu.spring6.autowire.controller public class UserController {private UserService userService;public void setUserService(UserService userService) {this.userService userService;}public void saveUser(){userService.saveUser();}}创建接口UserService package com.atguigu.spring6.autowire.service public interface UserService {void saveUser();}创建类UserServiceImpl实现接口UserService package com.atguigu.spring6.autowire.service.impl public class UserServiceImpl implements UserService {private UserDao userDao;public void setUserDao(UserDao userDao) {this.userDao userDao;}Overridepublic void saveUser() {userDao.saveUser();}}创建接口UserDao package com.atguigu.spring6.autowire.dao public interface UserDao {void saveUser();}创建类UserDaoImpl实现接口UserDao package com.atguigu.spring6.autowire.dao.impl public class UserDaoImpl implements UserDao {Overridepublic void saveUser() {System.out.println(保存成功);}}②配置bean 使用bean标签的autowire属性设置自动装配效果 自动装配方式byType byType根据类型匹配IOC容器中的某个兼容类型的bean为属性自动赋值 若在IOC中没有任何一个兼容类型的bean能够为属性赋值则该属性不装配即值为默认值null 若在IOC中有多个兼容类型的bean能够为属性赋值则抛出异常NoUniqueBeanDefinitionException bean iduserController classcom.atguigu.spring6.autowire.controller.UserController autowirebyType/beanbean iduserService classcom.atguigu.spring6.autowire.service.impl.UserServiceImpl autowirebyType/beanbean iduserDao classcom.atguigu.spring6.autowire.dao.impl.UserDaoImpl/bean自动装配方式byName byName将自动装配的属性的属性名作为bean的id在IOC容器中匹配相对应的bean进行赋值 bean iduserController classcom.atguigu.spring6.autowire.controller.UserController autowirebyName/beanbean iduserService classcom.atguigu.spring6.autowire.service.impl.UserServiceImpl autowirebyName/bean bean iduserServiceImpl classcom.atguigu.spring6.autowire.service.impl.UserServiceImpl autowirebyName/beanbean iduserDao classcom.atguigu.spring6.autowire.dao.impl.UserDaoImpl/bean bean iduserDaoImpl classcom.atguigu.spring6.autowire.dao.impl.UserDaoImpl/bean③测试 Test public void testAutoWireByXML(){ApplicationContext ac new ClassPathXmlApplicationContext(autowire-xml.xml);UserController userController ac.getBean(UserController.class);userController.saveUser(); }总结 以上就是Spring之容器IOC3的相关知识点希望对你有所帮助。 积跬步以至千里积怠惰以至深渊。时代在这跟着你一起努力哦
http://www.zqtcl.cn/news/814041/

相关文章:

  • 怎么用eclipse做网站开发推广平台取名字
  • 深圳建网站服务商广东佛山建网站
  • 网站推广公司卓立海创英文网站建设需求
  • 无锡网站营销公司简介最专业网站建设公司首选
  • 中文网站建设小组ios开发者账号申请
  • 月熊志网站福州建网站 做网页
  • 不同的网站有不同的风格宁波设计网站公司
  • 学校网站制作平台电子政务门户网站建设代码
  • 产品推广的网站怎么做网站标题与关键词
  • 青蛙网站建设wordpress修改logo
  • 网站套餐方案引擎搜索对人类记忆的影响
  • 滨州市滨城区建设局网站扎金花网站怎么做
  • 网站开发中视屏怎样编辑到网页上常州建站公司模板
  • 视频涉台互联网网站怎么做1cpu0.5g服务器用来做网站
  • 营销型网站设计官网怎么做网站优化 sit
  • 怎样获得做网站的客户免费企业网站程序上传
  • 新闻排版设计用什么软件网站seo诊断分析
  • 手机网站端域名怎样做解析一诺摄影设计
  • 网站开发行业竞争大吗郑州百度推广代运营公司
  • mvc4做网站五设计一个公司网站多少钱
  • 在什么网站可以做外贸出口劳保鞋北京 代理前置审批 网站备案
  • 邢台建设企业网站房地产宣传推广方案
  • 建设机械网站案例分析餐饮vi设计开题报告范文
  • 做本地生活网站深圳建设工程信息网站
  • C2C电商网站做博客的网站有哪些
  • 住房和城乡建设部网站 事故安微省建设厅田网站
  • 百度一下你就知道官页淘宝seo搜索引擎优化
  • 网站平台维护phpwind做的网站
  • 网站怎么做移动适配怎么样才算是一个网站页面
  • 做pc端网站策划百度网站建立