当某些情况下在编程 java 或 scala 时出现错误
type mismatch; found : Unit required: String
那是因为我的域或实体 g/set 方法出错了。
为什么我得到这个错误?和
我怎样才能克服错误?
例如,我将在 Scala 编程中显示我的实体和错误代码
领域
//@BeanProperty this line commented
@Column(name="USERNAME")
var userName:String=null
def getUserName() {
this.userName = userName
}
//@BeanProperty
@Column(name="PASSWORD")
var password:String=null
def getPassword() {
this.password = password
}
def setPassword(password:String) {
this.password = password
}
和错误在这里
@Transactional(propagation = Propagation.REQUIRED )
def loadUserByUsername(userName: String): UserDetails = {
log.info("==>calling loadUserByUsername for the user " + userName);
val userAccount: UserAccount = findUserAccount(userName);
new User(userAccount.getUserName(), userAccount.getPassword(),
here error ---^ ^---- and here
true, true, true, true, getGrantedAuthorities(userAccount));
}
编译错误显示:
Multiple markers at this line
- type mismatch; found : Unit
required: String
如果你知道这些请分享她..
问候米兰 :)