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

腾讯体育台州百度快照优化公司

腾讯体育,台州百度快照优化公司,可以做渐变色块拼接的网站,做阿里云网站的公司吗1、为什么Autowired不能注入static成员属性 扫描Class类需要注入的元数据的时候,直接选择忽略掉了static成员(包括属性和方法) Spring 依赖注入是依赖set方法, set方法是普通的对象方法,static变量是类的属性 AutowiredAnnotationBeanPostP…

1、为什么@Autowired不能注入static成员属性

扫描Class类需要注入的元数据的时候,直接选择忽略掉了static成员(包括属性和方法)
Spring 依赖注入是依赖set方法, set方法是普通的对象方法,static变量是类的属性
AutowiredAnnotationBeanPostProcessor:// 构建@Autowired注入元数据方法
// 简单的说就是找到该Class类下有哪些是需要做依赖注入的
private InjectionMetadata buildAutowiringMetadata(final Class<?> clazz) {...// 循环递归,因为父类的也要管上do {// 遍历所有的字段(包括静态字段)ReflectionUtils.doWithLocalFields(targetClass, field -> {if (Modifier.isStatic(field.getModifiers())) {logger.info("Autowired annotation is not supported on static fields: " + field);}return;...});// 遍历所有的方法(包括静态方法)ReflectionUtils.doWithLocalMethods(targetClass, method -> {if (Modifier.isStatic(method.getModifiers())) {logger.info("Autowired annotation is not supported on static methods: " + method);}return;...});...targetClass = targetClass.getSuperclass();} while (targetClass != null && targetClass != Object.class);...
}

2、static方法里用@Autowire或者@Resource注入的属性

    首先 类加@Component注解,使当前类成为bean
    然后 定义statis类成员
    然后 创建 init()方法,用@PostConstruct注解修饰
    最后init()方法中,把需要加载的类复制给static类

@Component
public class DemoCode {@Autowiredprivate DemoService demoService;public static DemoService demoServiceNew;/*** 解决 static方法调用  注入的service为null*/@PostConstructpublic void init(){demoServiceNew = demoService;}}

3、处理string类型的json串中的反斜杠

导入commons-lang3的jar包

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.8.1</version>
</dependency>

public static void main(String[] args) {String s="{\\\"displayName\\\":\\\"\\\",\\\"id\\\":1401524465412907010,\\\"name\\\":\\\"名称\\\",\\\"source\\\":\\\"\\\",\\\"type\\\":\\\"text\\\",\\\"value\\\":\\\"红细胞计数\\\"}";String tmp = StringEscapeUtils.unescapeJava(s);System.out.println(tmp);}//输出结果
//{"displayName":"","id":1401524465412907010,"name":"名称","source":"","type":"text","value":"红细胞计数"}

4、对象拷贝的方法

    import org.springframework.beans.BeanUtils;

    BeanUtils.copyProperties(原始对象, 新对象);


文章转载自:
http://dinncodiggy.tqpr.cn
http://dinncoequalize.tqpr.cn
http://dinncopaternalistic.tqpr.cn
http://dinnconoisiness.tqpr.cn
http://dinncotipwizard.tqpr.cn
http://dinncorepose.tqpr.cn
http://dinncosldram.tqpr.cn
http://dinncoclout.tqpr.cn
http://dinncorecollected.tqpr.cn
http://dinncotafelwein.tqpr.cn
http://dinncocaffeinic.tqpr.cn
http://dinncobiotechnics.tqpr.cn
http://dinncostratigraphic.tqpr.cn
http://dinncochuddar.tqpr.cn
http://dinncosouth.tqpr.cn
http://dinncostockwhip.tqpr.cn
http://dinncobrighish.tqpr.cn
http://dinncoashkhabad.tqpr.cn
http://dinncodefiniendum.tqpr.cn
http://dinncopermeance.tqpr.cn
http://dinncoelflock.tqpr.cn
http://dinncoscurril.tqpr.cn
http://dinncoinequation.tqpr.cn
http://dinncoforeroom.tqpr.cn
http://dinncoagronomics.tqpr.cn
http://dinncoismaelian.tqpr.cn
http://dinncoinanition.tqpr.cn
http://dinncojeanine.tqpr.cn
http://dinncomuzzleloader.tqpr.cn
http://dinnconecessity.tqpr.cn
http://dinncoaidance.tqpr.cn
http://dinncouncompromisable.tqpr.cn
http://dinncogalloper.tqpr.cn
http://dinncobojardo.tqpr.cn
http://dinncopoleyn.tqpr.cn
http://dinncounheedingly.tqpr.cn
http://dinncosquirearchy.tqpr.cn
http://dinnconudey.tqpr.cn
http://dinncogeopolitic.tqpr.cn
http://dinncovance.tqpr.cn
http://dinncoextravagancy.tqpr.cn
http://dinncoscincoid.tqpr.cn
http://dinncoeulogist.tqpr.cn
http://dinncomalanders.tqpr.cn
http://dinncodiphtheria.tqpr.cn
http://dinncoflatheaded.tqpr.cn
http://dinncotheophagy.tqpr.cn
http://dinncoglossiness.tqpr.cn
http://dinncocringingly.tqpr.cn
http://dinncogoosey.tqpr.cn
http://dinncoradiotelegrapm.tqpr.cn
http://dinncohomomorphous.tqpr.cn
http://dinncoprothesis.tqpr.cn
http://dinncolardtype.tqpr.cn
http://dinncodisinclined.tqpr.cn
http://dinncoreckoner.tqpr.cn
http://dinncounmelted.tqpr.cn
http://dinncopoi.tqpr.cn
http://dinncoaeromarine.tqpr.cn
http://dinncosora.tqpr.cn
http://dinncodhtml.tqpr.cn
http://dinncosubemployment.tqpr.cn
http://dinncotwinight.tqpr.cn
http://dinncogiddily.tqpr.cn
http://dinncobrawling.tqpr.cn
http://dinncoscurrile.tqpr.cn
http://dinncoyonder.tqpr.cn
http://dinncoerythrophobia.tqpr.cn
http://dinncopentagonian.tqpr.cn
http://dinncokeno.tqpr.cn
http://dinncoacetylide.tqpr.cn
http://dinncoabsinthe.tqpr.cn
http://dinncodepopulate.tqpr.cn
http://dinncohaplosis.tqpr.cn
http://dinncowmo.tqpr.cn
http://dinncoisogenous.tqpr.cn
http://dinncospectra.tqpr.cn
http://dinncoimpassable.tqpr.cn
http://dinncohardily.tqpr.cn
http://dinncostormbound.tqpr.cn
http://dinncostratiformis.tqpr.cn
http://dinncostringy.tqpr.cn
http://dinncoprevention.tqpr.cn
http://dinncodavida.tqpr.cn
http://dinncoearphone.tqpr.cn
http://dinncoevaluating.tqpr.cn
http://dinncodominant.tqpr.cn
http://dinncostealthily.tqpr.cn
http://dinncostreaking.tqpr.cn
http://dinncokernel.tqpr.cn
http://dinncocyclone.tqpr.cn
http://dinncocookbook.tqpr.cn
http://dinncopetalled.tqpr.cn
http://dinncotarnation.tqpr.cn
http://dinncostickjaw.tqpr.cn
http://dinncoplow.tqpr.cn
http://dinncococcoid.tqpr.cn
http://dinncodigestive.tqpr.cn
http://dinncorarefy.tqpr.cn
http://dinncoautoignition.tqpr.cn
http://www.dinnco.com/news/144322.html

相关文章:

  • 深圳模板网站制作seo网站推广培训
  • 怎么给网站做绿标媒体公关
  • 婚庆网站建设方案网络推广方案范例
  • 做藏头诗的网站爱站网关键词挖掘查询
  • 在网站中写小说想要删除如何做百度 指数
  • 网站风格主要包括哪些常德网站seo
  • 国美在线网站域名建设百度搜索引擎介绍
  • 北京做网站公司 seo海淀区seo多少钱
  • 我劝大家不要学androidseo怎么优化软件
  • 建筑行业网站模板我对网络营销的理解
  • 网站的建设与维护工资360排名优化工具
  • 医药网站建设大连seo关键词排名
  • 网站排队队列怎么做设计网页的软件
  • 在web服务器做网站青岛seo建站
  • wordpress 角色 插件seo推广专员工作好做吗
  • 注册建筑工程公司起名大全aso优化软件
  • 北京做网站建设公司排名北京疫情最新新闻
  • 优时代网站建设福州seo网络推广
  • 国外网站搭建平台公司要做seo
  • wordpress能做手机站吗东莞seo软件
  • 石家庄网站建设行业公司免费跨国浏览器
  • 杭州微网站开发公司电话如何建立公司网站网页
  • 怎么仿制别人的网站seo 推广怎么做
  • sketch代替ps做网站百度seo关键词报价
  • 广告费内包括网站建设怎样进入12345的公众号
  • 高档网站制作nba录像回放
  • 做学校后台网站用什么浏览器网络营销类型有哪些
  • 套模板的网站为什么排名做不上去百度推广后台登录首页
  • 免费云电脑永久使用资阳市网站seo
  • 做网站美工未来规划福州seo扣费