对于最新稳定版本,请使用Spring Framework 7.0.1spring-doc.cadn.net.cn

构造 函数

你可以通过使用新增功能算子。你应该用全套 所有类型除外的合格类别名称java.lang包 (整数,,字符串,依此类推)。以下示例展示了如何使用新增功能用来调用构造子的算符:spring-doc.cadn.net.cn

Inventor einstein = parser.parseExpression(
	"new org.spring.samples.spel.inventor.Inventor('Albert Einstein', 'German')")
		.getValue(Inventor.class);

// create new Inventor instance within the add() method of List
parser.parseExpression(
	"Members.add(new org.spring.samples.spel.inventor.Inventor('Albert Einstein', 'German'))")
		.getValue(societyContext);
val einstein = parser.parseExpression(
	"new org.spring.samples.spel.inventor.Inventor('Albert Einstein', 'German')")
		.getValue(Inventor::class.java)

// create new Inventor instance within the add() method of List
parser.parseExpression(
	"Members.add(new org.spring.samples.spel.inventor.Inventor('Albert Einstein', 'German'))")
		.getValue(societyContext)