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
これらについて知っているなら、彼女を共有してください..
よろしくミラノ:)