#java #spring #spring-boot #mybatis
#java #весна #весенняя загрузка #mybatis
Вопрос:
Проблема в том, что каждый раз, когда я запускаю проект, ошибка из org.springframework.beans.factory.Всплывающее окно UnsatisfiedDependencyException.
Я уже попробовал несколько связанных вопросов в стеке с ответами, но проблема еще не решена.
FieldDataService.java
@Component
public interface FieldDataService {
public FieldData getFieldData() throws SQLException, Exception;
}
FieldDataServiceImpl.java
@Component
public class FieldDataServiceImpl implements FieldDataService {
@Autowired
FieldDataDao fieldDataDao;
@Override
public FieldData getFieldData() throws SQLException, Exception {
return this.fieldDataDao.getFieldData();
}
}
FieldDataDao.java
@Component
public interface FieldDataDao {
public FieldData getFieldData() throws SQLException, Exception;
}
FieldDataDaoImpl.java
@Component
public class FieldDataDaoImpl implements FieldDataDao{
@Autowired
private SqlSession sqlSession;
@Override
public FieldData getFieldData() throws SQLException, Exception {
FieldData result = new FieldData();
try {
result = this.sqlSession.selectOne("getFieldData");
} catch (Exception e) {
e.printStackTrace();
}
return resu<
}
}
FieldData.java
@Component
public class FieldData {
private String transactionType;
private String distribution;
private Date startDate;
private Date endDate;
private String reportType;
public String getTransactionType() {
return transactionType;
}
public void setTransactionType(String transactionType) {
this.transactionType = transactionType;
}
public String getDistribution() {
return distribution;
}
public void setDistribution(String distribution) {
this.distribution = distribution;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public String getReportType() {
return reportType;
}
public void setReportType(String reportType) {
this.reportType = reportType;
}
@Override
public String toString() {
return "FieldData [transactionType=" transactionType ", distribution=" distribution ", startDate="
startDate ", endDate=" endDate ", reportType=" reportType "]";
}
}
FieldData.xml
<mapper namespace="com.pnb.allianz.jdt.maper.FieldData">
<resultMap id="FieldDataResultMap" type="FielData">
<result column="LF2S_TRAN_TYPE" property="transactionType"/>
<result column="LF2S_DISTRIBUTION" property="distribution"/>
<result column="LF2S_REPORT_TYPE" property="reportType"/>
</resultMap>
<select id="getFieldData" resultMap="FieldDataResultMap">
SELECT * FROM LF2S_MR_PARAMETERS
WHERE rownum =1
</select>
</mapper>
..и ошибка выглядит следующим образом
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'generateJdtController': Unsatisfied dependency expressed through field 'fieldDataService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fieldDataServiceImpl': Unsatisfied dependency expressed through field 'fieldDataDao'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fieldDataDaoImpl': Unsatisfied dependency expressed through field 'sqlSession'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionTemplate' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionTemplate' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.lang.NullPointerException
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fieldDataService' defined in file [C:Usersmarkanthony.ragayDesktopjulia-document-trackingjulia-document-trackingtargetclassescompnballianzjdtserviceFieldDataService.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.lang.NullPointerException
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fieldDataService' defined in file [C:Usersmarkanthony.ragayDesktopjulia-document-trackingjulia-document-trackingtargetclassescompnballianzjdtserviceFieldDataService.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fieldDataDao' defined in file [C:Usersmarkanthony.ragayDesktopjulia-document-trackingjulia-document-trackingtargetclassescompnballianzjdtdaoFieldDataDao.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.lang.NullPointerException
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fieldDataDao' defined in file [C:Usersmarkanthony.ragayDesktopjulia-document-trackingjulia-document-trackingtargetclassescompnballianzjdtdaoFieldDataDao.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.lang.NullPointerException
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fieldDataDao' defined in file [C:Usersmarkanthony.ragayDesktopjulia-document-trackingjulia-document-trackingtargetclassescompnballianzjdtdaoFieldDataDao.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fieldDataService' defined in file [C:Usersmarkanthony.ragayDesktopjulia-document-trackingjulia-document-trackingtargetclassescompnballianzjdtserviceFieldDataService.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.lang.NullPointerException
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fieldDataService' defined in file [C:Usersmarkanthony.ragayDesktopjulia-document-trackingjulia-document-trackingtargetclassescompnballianzjdtserviceFieldDataService.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.lang.NullPointerException
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fieldDataService' defined in file [C:Usersmarkanthony.ragayDesktopjulia-document-trackingjulia-document-trackingtargetclassescompnballianzjdtserviceFieldDataService.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fieldDataDao' defined in file [C:Usersmarkanthony.ragayDesktopjulia-document-trackingjulia-document-trackingtargetclassescompnballianzjdtdaoFieldDataDao.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.lang.NullPointerException
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fieldDataDao' defined in file [C:Usersmarkanthony.ragayDesktopjulia-document-trackingjulia-document-trackingtargetclassescompnballianzjdtdaoFieldDataDao.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.lang.NullPointerException
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fieldDataDao' defined in file [C:Usersmarkanthony.ragayDesktopjulia-document-trackingjulia-document-trackingtargetclassescompnballianzjdtdaoFieldDataDao.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fieldDataService' defined in file [C:Usersmarkanthony.ragayDesktopjulia-document-trackingjulia-document-trackingtargetclassescompnballianzjdtserviceFieldDataService.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.lang.NullPointerException
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fieldDataService' defined in file [C:Usersmarkanthony.ragayDesktopjulia-document-trackingjulia-document-trackingtargetclassescompnballianzjdtserviceFieldDataService.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.lang.NullPointerException
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fieldDataService' defined in file [C:Usersmarkanthony.ragayDesktopjulia-document-trackingjulia-document-trackingtargetclassescompnballianzjdtserviceFieldDataService.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fieldDataDao' defined in file [C:Usersmarkanthony.ragayDesktopjulia-document-trackingjulia-document-trackingtargetclassescompnballianzjdtdaoFieldDataDao.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.lang.NullPointerException
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fieldDataDao' defined in file [C:Usersmarkanthony.ragayDesktopjulia-document-trackingjulia-document-trackingtargetclassescompnballianzjdtdaoFieldDataDao.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.lang.NullPointerException
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fieldDataDao' defined in file [C:Usersmarkanthony.ragayDesktopjulia-document-trackingjulia-document-trackingtargetclassescompnballianzjdtdaoFieldDataDao.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fieldDataService' defined in file [C:Usersmarkanthony.ragayDesktopjulia-document-trackingjulia-document-trackingtargetclassescompnballianzjdtserviceFieldDataService.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.lang.NullPointerException
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fieldDataService' defined in file [C:Usersmarkanthony.ragayDesktopjulia-document-trackingjulia-document-trackingtargetclassescompnballianzjdtserviceFieldDataService.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.lang.NullPointerException
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fieldDataService' defined in file [C:Usersmarkanthony.ragayDesktopjulia-document-trackingjulia-document-trackingtargetclassescompnballianzjdtserviceFieldDataService.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fieldDataDao' defined in file [C:Usersmarkanthony.ragayDesktopjulia-document-trackingjulia-document-trackingtargetclassescompnballianzjdtdaoFieldDataDao.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.lang.NullPointerException
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fieldDataDao' defined in file [C:Usersmarkanthony.ragayDesktopjulia-document-trackingjulia-document-trackingtargetclassescompnballianzjdtdaoFieldDataDao.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.lang.NullPointerException
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fieldDataDao' defined in file [C:Usersmarkanthony.ragayDesktopjulia-document-trackingjulia-document-trackingtargetclassescompnballianzjdtdaoFieldDataDao.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fieldDataService' defined in file [C:Usersmarkanthony.ragayDesktopjulia-document-trackingjulia-document-trackingtargetclassescompnballianzjdtserviceFieldDataService.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.lang.NullPointerException
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fieldDataDao' defined in file [C:Usersmarkanthony.ragayDesktopjulia-document-trackingjulia-document-trackingtargetclassescompnballianzjdtdaoFieldDataDao.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fieldDataDao' defined in file [C:Usersmarkanthony.ragayDesktopjulia-document-trackingjulia-document-trackingtargetclassescompnballianzjdtdaoFieldDataDao.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fieldDataService' defined in file [C:Usersmarkanthony.ragayDesktopjulia-document-trackingjulia-document-trackingtargetclassescompnballianzjdtserviceFieldDataService.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
2019-04-08 14:30:32.380 INFO 2284 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2019-04-08 14:30:32.410 INFO 2284 --- [ restartedMain] ConditionEvaluationReportLoggingListener :
Заранее спасибо, ребята. Надеюсь, вы сможете мне помочь.
Комментарии:
1. Я предполагаю, что есть проблема с вашим источником данных sql, его null . Проверьте настройки подключения
2. если ваш класс данных поля является сущностью, тогда вы должны использовать @Entity для этого класса. Поскольку вы используете mybatis для взаимодействия с БД. Пожалуйста, исправьте, если это неправильно.
3. Проверьте свою SessionFactory: трассировка стека исключений указывает на то, что: не удалось создать экземпляр [org.apache.ibatis.session. SqlSessionFactory]: Фабричный метод ‘SqlSessionFactory’ выдал исключение; вложенным исключением является java.lang. Исключение NullPointerException Также я бы посоветовал удалить аннотацию @Component из ваших интерфейсов, поскольку они кажутся ненужными.
4. @thehandofNOD Я попытался удалить аннотацию @ Component на интерфейсах, но ошибка все та же
5. Попробуйте использовать: mybatis.org/spring-boot-starter/… Существует также пример с SqlSession .
Ответ №1:
Вам необходимо проверить свой sqlSessionFactory
. это исключение NullPointerException
.
Ваше сообщение об ошибке
Неудовлетворенная зависимость, выраженная с помощью параметра метода ‘SqlSessionTemplate’ 0; вложенным исключением является org.springframework.beans.factory.Исключение BeanCreationException: ошибка при создании компонента с именем ‘SqlSessionFactory’, определенным в ресурсе пути к классу [ org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class ]: Не удалось создать экземпляр компонента с помощью заводского метода; вложенным исключением является org.springframework.beans.Исключение BeanInstantiationException: не удалось создать экземпляр [org.apache.ibatis.session .SqlSessionFactory]: Фабричный метод ‘SqlSessionFactory’ выдал исключение; вложенным исключением является java.lang.Исключение NullPointerException