Today, when you encounter a tool class, you need to inject a property statically, in the following way:
The first step: Set and Get methods of attributes do not add static
PackageCn.com.chinalife.ebusiness.common.util;ImportCn.com.chinalife.ebusiness.sys.interfacePortal.businessInterface.service.facade.InterfaceInfoService; Public classEpolicydownload {Private StaticInterfaceinfoservice Interfaceinfoservice; PublicInterfaceinfoservice Getinterfaceinfoservice () {returnInterfaceinfoservice; } Public voidSetinterfaceinfoservice (Interfaceinfoservice interfaceinfoservice) {//Note: Do not add staticEpolicydownload.interfaceinfoservice =Interfaceinfoservice; } }
Step Two: Configure the bean to be lazy loaded in spring's configuration file
<bean id= "Epolicydownload" class= "cn.com.chinalife.ebusiness.common.util.EPolicyDownload" lazy-init= "false " ></bean>
Then, after the service starts, the static properties are initialized.
Spring static Property injection