org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'spring.datasource-org.springframework.boot.autoconfigure.jdbc.DataSourceProperties': Could not bind properties to 'DataSourceProperties' : prefix=spring.datasource, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is java.lang.IllegalStateException: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@dcea035 has been closed already
I’m getting this error. After this error the code stops working and then works again.
List<Map<String, Object>> rpkListesi = yedekRepository.getYedekParcaRaporuRpkListesi(rpkParams1);
if (rpkListesi != null && !rpkListesi.isEmpty()) {
document.newPage();
PdfPTable pdfPTable = new PdfPTable(1);
pdfPTable.addCell(new Phrase());
pdfPTable.setSpacingAfter(50);
document.add(pdfPTable);
resimDiyagramEkle(document, writer, "dokuman", rpkListesi.get(0).get("dosyaPath").toString(), "S", true);
PdfPTable rpkTable = yedekRpkTableOlustur(document, font11Bold, font10, !isNullOrEmpty(rpkListesi));
Map<String, Object> rpkParams2 = new HashMap<>();
rpkParams1.put("dokumanId", rpkListesi.get(0).get("dokumanId"));
rpkParams1.put("parcaId", yedekLahika.get(j).get("parcaId"));
List<Map<String, Object>> malzemeAciklamasi = yedekRepository.getYedekRpkListesi(rpkParams1);
rpkTable = rpkEkle(rpkTable, malzemeAciklamasi.get(0), font10, font9, font6);
document.add(rpkTable);
}
The error occurs from the following lines of code
List<Map<String, Object>> rpkListesi = yedekRepository.getYedekParcaRaporuRpkListesi(rpkParams1);
List<Map<String, Object>> malzemeAciklamasi = yedekRepository.getYedekRpkListesi(rpkParams1);
Here is the code in repository
public List<Map<String, Object>> getYedekParcaRaporuRpkListesi(Map<String, Object> params) {
String queryStr = "" +
"SELECTn" +
" d.id as dokuman_id,n" +
" d.dosya_adi,n" +
" d.dosya_pathn" +
" FROM DOKUMAN D,PARCA_LKN PL,LKN L n" +
" WHERE PL.PARCA_ID = :parcaIdn" +
" AND PL.DOKUMAN_ID = D.IDn" +
" AND PL.LKN_ID = L.IDn" +
" AND L.PROJE_KODU = :projeKodun" +
" AND L.BORDA_NO = :bordaNon" +
" AND l.yol like ('%.' || :lknId || '.%')n" +
" AND pl.miktar > 0";
Query query = entityManager.createNativeQuery(queryStr);
if (isNotEmpty(params.get("parcaId")))
query.setParameter("parcaId", params.get("parcaId"));
if (isNotEmpty(params.get("projeKodu")))
query.setParameter("projeKodu", params.get("projeKodu"));
if (isNotEmpty(params.get("bordaNo")))
query.setParameter("bordaNo", params.get("bordaNo"));
if (isNotEmpty(params.get("lknId")))
query.setParameter("lknId", params.get("lknId"));
I use this code in another page but I don’t get an error there. What do I need to do to fix it?