The first way:
xx.properties error attribute name, is not performed corresponding @Value ( "$ {xxx}")
The second way:
Such spring bean not injected into the vessel
@Component
@Controller
@Service
# The above is not injected, using @Autowired will complain
@Autowired
The third way:
Using new obtain this object, etc.
@Component class TestValue{ @Value("${tag}") private String tagValue; } class Test{ ... TestValue testValue = new TestValue() } \
The fourth way
The static final properties with other words be modified
@Value("${value}")
private static String value; //错误
@Value("${value}")
private final String value; //错误
Fifth way
The property name in uppercase
@Value("${value}") private static String VALUE; //错误
Reference documents: https://blog.csdn.net/zzmlake/article/details/54946346
The fifth way is what I really met, if there are other ways will lead to @Value ( "$ {xxx}") is null,
Please leave a message at the bottom,