次の問題があります。
私は一般的なクラスAを持っています
public class A<T, DAO extends JpaRepository<?, ?>>
{
@Autowired
protected DAO daoObject;
......
そこで、JpaRepository タイプのジャンル的な DAO オブジェクトを注入しようとしています。
注入されたオブジェクト(JpaRepositoryの)の実装が1つしかない場合は問題ありませんが、複数ある場合、Springは注入するオブジェクトを認識せず、例外をスローします。
問題は、一般的な情報に基づいてダイナミッシュし、正しいオブジェクトを注入するにはどうすればよいかということです。
ありがとうございました。
public interface IRegisteredUserDAO extends JpaRepository<RegisteredUser, String> {
}
public interface IMailLogDao extends JpaRepository<MailLog, Long> {
findByTo(String to);
}
そして私はそれを使った
public class RegisteredUserVM extends YBTableViewModel<RegisteredUser, IRegisteredUserDAO>
{
アップデート:
public class MailLogVM extends YBTableViewModel<MailLog, IMailLogDao>
{
}