One, the spring component overrides the constructor method, and reference @value in the constructor method is null
Because the spring instantiation order is the first to execute the constructor method and then inject the member variable, the order is to execute the construction method first and then inject the member variable, so the ING instantiation value is null
The workaround is to write a constant class, refer to @value in the constant class, and then reference the variable of the constant class in the constructor method.
Second, use the new object when calling the spring component instead of @autowired
Third, use final or static modifier member variable
Four, the reference @value in spring MVC is null
Spring MVC is a child container of spring and requires a configuration file to be imported in two configuration files
<context:property-placeholder location= "Classpath:jdbc.properties" ignore-unresolvable= "true"/>
[email protected] several cases where the value cannot be taken