我想传递 int 而不是字符串,它是 Spring PropertyPlaceholderConfigurer 中默认的字符串。<property name="mailServerPort" value="${mail.port}" /> 这给了我错误,因为mailServerPort是int类型,而$ {mail.port}是字符串类型。如何将$ {mail.port}转换为int? 最佳答案 Spring会根据目标类型处理转换。确定要设定吗mail.port 值与整数?