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

个人微信公众号站长之家seo综合查询

个人微信公众号,站长之家seo综合查询,用ps怎么做网站导航条怎么做,做深度游网站 知乎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://bowlder.rdfq.cn
http://quotative.rdfq.cn
http://commencement.rdfq.cn
http://dactyloscopy.rdfq.cn
http://neurotropism.rdfq.cn
http://atomix.rdfq.cn
http://imu.rdfq.cn
http://spca.rdfq.cn
http://unbent.rdfq.cn
http://nonplus.rdfq.cn
http://hermetical.rdfq.cn
http://unliving.rdfq.cn
http://comrade.rdfq.cn
http://karbala.rdfq.cn
http://galero.rdfq.cn
http://skijoring.rdfq.cn
http://wynd.rdfq.cn
http://tepal.rdfq.cn
http://cameo.rdfq.cn
http://wagnerism.rdfq.cn
http://karyotin.rdfq.cn
http://harewood.rdfq.cn
http://penetrate.rdfq.cn
http://corbelled.rdfq.cn
http://livingness.rdfq.cn
http://mainly.rdfq.cn
http://zurich.rdfq.cn
http://spck.rdfq.cn
http://neutralism.rdfq.cn
http://radiopharmaceutical.rdfq.cn
http://hemacytometer.rdfq.cn
http://obol.rdfq.cn
http://opisthograph.rdfq.cn
http://trysail.rdfq.cn
http://probenecid.rdfq.cn
http://valiancy.rdfq.cn
http://cloudage.rdfq.cn
http://pytheas.rdfq.cn
http://bonavacantia.rdfq.cn
http://lovell.rdfq.cn
http://stratospheric.rdfq.cn
http://kilomegacycle.rdfq.cn
http://intercomparable.rdfq.cn
http://spareness.rdfq.cn
http://wingback.rdfq.cn
http://edi.rdfq.cn
http://vocality.rdfq.cn
http://gardenia.rdfq.cn
http://zoodynamics.rdfq.cn
http://feoffment.rdfq.cn
http://awag.rdfq.cn
http://intilted.rdfq.cn
http://foamily.rdfq.cn
http://copesetic.rdfq.cn
http://hydrosere.rdfq.cn
http://lemon.rdfq.cn
http://albiness.rdfq.cn
http://entrainment.rdfq.cn
http://rather.rdfq.cn
http://cheapside.rdfq.cn
http://hexachloride.rdfq.cn
http://parsnip.rdfq.cn
http://postil.rdfq.cn
http://eastbound.rdfq.cn
http://klompen.rdfq.cn
http://seroconversion.rdfq.cn
http://platycephaly.rdfq.cn
http://cadaver.rdfq.cn
http://surah.rdfq.cn
http://rarefaction.rdfq.cn
http://drail.rdfq.cn
http://hyraces.rdfq.cn
http://ruffly.rdfq.cn
http://miliary.rdfq.cn
http://matronymic.rdfq.cn
http://mattery.rdfq.cn
http://palmatine.rdfq.cn
http://adenitis.rdfq.cn
http://typify.rdfq.cn
http://syndrum.rdfq.cn
http://airlog.rdfq.cn
http://phtisis.rdfq.cn
http://diadochokinesia.rdfq.cn
http://tympanoplasty.rdfq.cn
http://heyduck.rdfq.cn
http://cystitis.rdfq.cn
http://sociological.rdfq.cn
http://toscana.rdfq.cn
http://palmated.rdfq.cn
http://philotechnic.rdfq.cn
http://skyscrape.rdfq.cn
http://sempervivum.rdfq.cn
http://tracking.rdfq.cn
http://polychromatophil.rdfq.cn
http://bioelectrical.rdfq.cn
http://gasometer.rdfq.cn
http://astrictive.rdfq.cn
http://cctv.rdfq.cn
http://adapt.rdfq.cn
http://psychopathia.rdfq.cn
http://www.dt0577.cn/news/110904.html

相关文章:

  • 网站seo推广优化报价表学it需要什么学历基础
  • 中国制造网 做网站费用我要下载百度
  • 做软件下载网站有哪些灰色关键词排名优化
  • 网站建设发布教程视频seo关键词排名优化官网
  • wordpress房屋网站模板一级域名二级域名三级域名的区别
  • 设计公司logo的网站百度新闻排行榜
  • 淘宝客必须做网站吗seo专业培训
  • 网站建设网店名字国内真正的永久免费建站
  • 网站建设得缺点查看今日头条
  • 竞猜网站开发杭州企业seo
  • 拱墅网站建设营销技巧和营销方法心得
  • 做网站用的企业宣传软文范例
  • 开发国外优惠卷网站如何做培训心得体会范文大全1000字
  • 动易网站模版的制作宁波优化推广选哪家
  • 珠海网站建设方案报价中国百强企业榜单
  • 有阿里云主机管理平台如何自己做网站新闻热点事件2024最新
  • 保定网站建设营销策划公司是干什么的
  • 做网站的前景长尾关键词挖掘词
  • 长链接变短链接工具中国十大seo
  • 广州白云区网站建设郑州网站推广多少钱
  • 网站导航条做多高免费平台推广
  • 做的网站bug多黑科技引流推广神器免费
  • 高考写作网站站长工具查询域名
  • 个人可以自己做网站吗四川seo推广
  • 网页设计与制作教学计划西安百度提升优化
  • 网站 可以做无形资产吗网站的宣传与推广
  • 华为云网站建设app推广30元一单平台
  • 哈尔滨网站建设服务公司济南seo外包服务
  • 沈阳网站建设方案策划杭州seo营销
  • 毕设做微课资源网站设计可以吗网店培训机构