在配置邮件服务com.day.cq.mailer.DefaultMailService
时,我知道 SMTP 端口应该是一个整数 ( smtp.port=I"465"
)。
但是如果我尝试使用配置sling:OsgiConfig
节点进行配置,因为 CRX 没有为数据类型提供整数(只有十进制、双精度和长整数),我无法实现这一点。
有没有其他选择?
在配置邮件服务com.day.cq.mailer.DefaultMailService
时,我知道 SMTP 端口应该是一个整数 ( smtp.port=I"465"
)。
但是如果我尝试使用配置sling:OsgiConfig
节点进行配置,因为 CRX 没有为数据类型提供整数(只有十进制、双精度和长整数),我无法实现这一点。
有没有其他选择?
使用String
type in sling:OsgiConfig
node 给出smtp:port
in CRX/DE。这是由 内部处理的DefaultMailService
。
如果我们看到DefaultMailService
实现smtp.port
是String
, 是由注解处理的
@Property(intValue={25})
private static final String SMTP_PORT = "smtp.port";
Sandeep 是错误的,内部表示不是String
。该SMTP_PORT
变量是 type String
,因为它包含一个标签而不是字段值。实际值为 type int
。但是您可以在 crx.de 中将值设置为 Long,因为该值将在内部强制转换为int
then。
String
也可能有效,但我没有测试。