我可以在@ComponentScan :: lazyInit中将String转换为Boolean吗?

时间:2016-05-30 06:21:30

标签: java spring-boot dynamic-properties

application.properties

app.lazy_init=true

并在Main课程中:

@ComponentScan(lazyInit = "${app.lazy_init: false}")
public class Main(){...}

lazyInitBoolean,如何在String中将Boolean转换为@ComponentScan::lazyInit

1 个答案:

答案 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,因为转换必须在运行时执行。