2016-04-22 4 views
1

У меня есть 1 ошибка:Bean свойство 'SessionFactory' не доступен для записи или имеет недопустимый метод установки

Invalid property 'sessionFactory' of bean class [com.aptech.mavenspringmvc.dao.StudentDAOImpl]: Bean property 'sessionFactory' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

enter image description here

enter image description here

Файл DAO реализации

@Repository 
public class StudentDAOImpl implements StudentDAO{ 
    @Autowired 
public SessionFactory session; 

Файл DAO

@Service 
public class StudentServiceImpl implements StudentService{ 

//@Autowired 
public StudentDAO studao; 

public void setStudao(StudentDAO studao) { 
    this.studao = studao; 
} 

public StudentDAO getStudao() { 
    return studao; 
} 

контроллер файла

@Controller 
public class StudentController { 
// @Autowired 
private StudentService stuSer; 

ответ

1
@Repository 
public class StudentDAOImpl implements StudentDAO{ 

@Autowired 
public SessionFactory sessionFactory; 
.... 

public void setSessionFactory(SessionFactory sessionFactory){ 
    this.sessionFactory = sessionFactory; 
    } 
} 
+0

Спасибо за ваш ответ, но до сих пор не работает с этой ошибкой –

+0

обновил мой ответ – Helios

0

В конфигурации XML, вы настраиваете SessionFactory свойство studDao боба.

Но свойство называется сеансом в коде, который вы отправили.

+0

спасибо за ваш ответ, но до сих пор не работает –

+0

У вас есть метод установки для свойства «сеанса» в DaoImpl? –

+0

ОК спасибо большое –

Смежные вопросы

 Смежные вопросы