Inheritance relationship causes class loading order

Question: when wechat authentication defines variables in weixinpaycontroller, the assigned value is obtained by reading the configuration file in initcontroller, which may cause that sometimes the data of the configuration file cannot be read?

 

Reason: This is caused by the loading order of the controller. First, the class inheritance relationship of weixinpaycontroller is weixinpaycontroller — & gt; absauthcontroller — & gt; basemcccontroller — & gt; mvccontroller. The inheritance relationship of initcontroller class is initcontroller — & gt; mvccontroller. It can be seen that these two controllers are inherited from mvccontroller, so there will be the problem of loading order first and then

 

Short term solution: when deploying online, test it first, and you can see that there is no problem. If there is no problem, you can. If there is a problem, it will be deployed again, and then detected again

 

Long term solution: weixinpaycontroller is directly inherited from initcontroller, so that the loading order is fixed and consistent


Read More: