【发布时间】:2017-08-03 17:02:29
【问题描述】:
我有这门课:
@Transactional
@Repository("reportManagementDAO")
public class ReportManagementDAOImpl implements ReportManagementDAO,
Serializable{
@Autowired
private SessionFactory getSessionFactory;
public SessionFactory getSessionFactory(){
return sessionFactory;
}
public void setSessionFactory(SessionFactory sessionFactory){
this.sessionFactory = sessionFactory;
}
class ReportWork extends AbstractReportWork{
}
}//
abstract class AbstractReportWork extends RCDStoreProcedureWork {
void doReport() {
//How can I access to: ReportManagementDAOImpl.getSessionFactory()
//using reflection, for example:
//Class<?> type = getClass().getEnclosingClass();
}
}
如何通过外部类使用反射访问:ReportManagementDAOImpl.getSessionFactory()????
【问题讨论】:
-
@david-basarab 你们能在标记为重复之前阅读这个该死的问题吗?这与访问不可见的类无关。这里的external这个词的意思是outer类。没有其他相似之处。
标签: java hibernate reflection inner-classes