spring MVC注解属性配置为整型数据变量?
/**
内存中保存的消息最大长度
*/
@Value("${MsgStoreLength}")
Integer MsgStoreLength;
以上无效报:java.lang.NullPointerException
@RequestMapping(value="/users/{userId}/topics/{topicId}")
public String test(
@PathVariable(value="userId") int userId,
@PathVariable(value="topicId") int topicId)
指的是这样绑定传入参数吗
@Value 是spring的注解,是表示从properties配置文件中读取配置信息。报空指针可能是因为配置文件中没有这个配置。
第一种是配置文件没有该属性
第二种是web请求url中参数的映射
内存中保存的话 怎么可能会用@Value这个注解呢 这是从配置文件中读取的