Java reflection & dynamic agent

Java3y 2021-01-14 13:05:26
java reflection dynamic agent


// abstract class , Define generics <T>
public abstract class BaseDao<T> {
public BaseDao(){
Class clazz = this.getClass();
ParameterizedType pt = (ParameterizedType) clazz.getGenericSuperclass();
clazz = (Class) pt.getActualTypeArguments()[0];
System.out.println(clazz);
}
}
// Implementation class
public class UserDao extends BaseDao<User> {
public static void main(String[] args) {
BaseDao<User> userDao = new UserDao();
}
}
// Execution result output
class com.entity.User

After a day , The interviewer saw that everyone was in a row . He added another question to me : It's said that reflection affects performance , Is there any way to reduce its performance impact ?

answer : You can use caching to store reflected metadata , The next time you use it, you can get it directly from memory . Use as much as possible High performance reflection framework ( It's all packaged for you , You don't have to do it yourself )

The article explains from the perspective of pure interview , So there are a lot of details that are unfounded .

In view of the feedback from many students, I didn't understand 【 On line interviewers 】 series , I did write an article to explain the basic knowledge , But some students just don't like to translate .

To give you a better experience , I also find out the basic articles ( I have also sorted out the important knowledge points e-book , Like multithreading 、 Set this kind of interview must test has long been turned into PDF Format )

I put these Upload to the network disk , You need to download it directly . It's done , I don't want to go whoring for nothing give the thumbs-up and forward No money .

link :https://pan.baidu.com/s/1pQTuKBYsHLsUR5ORRAnwFg password :3wom

Welcome to my WeChat official account. 【Java3y】 To have a chat Java interview

【 On line interviewers 】 series Two continuous updates a week !

版权声明
本文为[Java3y]所创,转载请带上原文链接,感谢
https://javamana.com/2021/01/20210114093301757d.html

  1. 基于Jmeter实现Rocketmq消息发送
  2. Java advanced (29) -- HashMap set
  3. Weblogic 2017-3248 analysis of Java Security
  4. 基于Jmeter实现Rocketmq消息发送
  5. Kubernetes official java client 8: fluent style
  6. Explain the function of thread pool and how to use it in Java
  7. Java reflection & dynamic agent
  8. 我的程序员之路:自学Java篇
  9. Comparative analysis of common sorting algorithms of data structure
  10. Application of linear table of data structure
  11. JavaScript
  12. Fast integration of imsdk and Huawei offline push
  13. Fast integration of imsdk and Huawei offline push
  14. 我的程序员之路:自学Java篇
  15. 一网打尽,一文讲通虚拟机VirtualBox及Linux使用
  16. The architecture of MySQL
  17. . net cloud native architect training camp
  18. 一网打尽,一文讲通虚拟机VirtualBox及Linux使用
  19. Remember to use it once Asp.Net The development process of core webapi 5.0 + dapper + MySQL + redis + docker
  20. Java Concurrent Programming points
  21. RBAC authorization mode of k8s
  22. Description of dependency problem after javacv is updated to 1.5. X and how to reduce the size of dependency package
  23. How does serverless deal with the resource supply demand of k8s in the offline scenario
  24. Detailed explanation of HBase basic principle
  25. 【Java练手项目】Java身份证号码识别系统
  26. Spring security oauth2.0 authentication and authorization 4: distributed system authentication and authorization
  27. Serverless 如何應對 K8s 在離線場景下的資源供給訴求
  28. HBase 底層原理詳解(深度好文,建議收藏)
  29. 詳解執行緒池的作用及Java中如何使用執行緒池
  30. Kubernetes官方java客戶端之八:fluent style
  31. Three main problems and solutions of redis
  32. Springboot test redis connection, after starting a variety of error solutions
  33. Installing and configuring redis under Linux
  34. Implementation of fastdfs upload file demo -- springboot
  35. Collation of MySQL Cluster Knowledge Points
  36. Installation of SVN under Linux
  37. Weblogic 2017-3248 analysis of Java Security
  38. Spring Festival in the year of the ox, the most useless year
  39. Crawler series | 2, HTTP request and response, write crawler these contents must master
  40. JQuery table plug-in DataTables
  41. Spring boot static resource configuration principle (step by step source analysis, detailed and easy to understand)
  42. 400万Docker镜像中,51%的镜像存在高危漏洞
  43. Head first design pattern -- 10. Iterator pattern
  44. A few pictures, take down the HTTPS
  45. Simple use of pyecharts module
  46. [azure redis cache] discussion on the functionality of azure redis
  47. Installation of SVN under Linux
  48. Sorting out knowledge points of MySQL Cluster
  49. rocketmq-cpp-client Visual Studio 2019 编译
  50. rocketmq-cpp-client Visual Studio 2019 编译
  51. RBAC authorization mode of k8s
  52. Remember to use it once Asp.Net The development process of core webapi 5.0 + dapper + MySQL + redis + docker
  53. Java Concurrent Programming points
  54. Explain Java I / O flow in detail
  55. Linux system builds springboot project environment and deploys it
  56. Easy to understand JS object-oriented, by the way understand prototype and__ proto__
  57. Summary of java basic knowledge
  58. . net cloud native architect training camp (module 2 basic consolidation rabbitmq mastransit detailed explanation) - learning notes
  59. The architecture of MySQL
  60. MySQL security management, database maintenance and performance improvement