在application.properties
:
app.lazy_init=true
并在Main
课程中:
@ComponentScan(lazyInit = "${app.lazy_init: false}")
public class Main(){...}
但lazyInit
是Boolean
,如何在String
中将Boolean
转换为@ComponentScan::lazyInit
?
答案 0 :(得分:0)
你做不到。 [collectionView removeConstraints: [collectionView constraints]];
// top constraint
view.addConstraint(NSLayoutConstraint(item: self.collectionView, attribute: .Top, relatedBy: .Equal, toItem: view, attribute: .Top, multiplier: 1, constant: 0))
// leading constraint
view.addConstraint(NSLayoutConstraint(item: self.collectionView, attribute: .Leading, relatedBy: .Equal, toItem: view, attribute: .Leading, multiplier: 1, constant: 0))
// trailing constaint
view.addConstraint(NSLayoutConstraint(item: self.collectionView, attribute: .Trailing, relatedBy: .Equal, toItem: view, attribute: .Trailing, multiplier: 1, constant: 0))
// your constraint
let newConstraint = NSLayoutConstraint(item: messageInputContainerView, attribute: .Top, relatedBy: .Equal, toItem: self.collectionView! , attribute: .Bottom, multiplier: 1, constant: 0)
view.addConstraint(newConstraint)
被输入为lazyInit
,因此在编译时,您配置它的值必须是boolean
。换句话说,没有机会将boolean
转换为String
,因为转换必须在运行时执行。