Powered by Blogger.

Wednesday 17 May 2023

Learn I- Report configuration with Spring boot/Microservices using Java

1 comment :
iReport
iReport is a powerful graphical design tool for report designers and power users to define reports for execution using the JasperReports engine. Whether you are using the JasperReports library by itself as a critical component of your application or you are using it as a component of the JasperReports Server application, iReport can help you design reports to meet the most complex reporting demands. iReport is built on the NetBeans platform and is available as a standalone application or as a Netbeans plug-in.
Requirements For current Download JasperReports iReport Tools , Ckeck It is recommended that you run iReport with JDK v1.5,v1.6 or v1.7. Note that for Windows Vista users, it is recommended that you run JDK v1.7.
JasperReports Create very sophisticated layouts containing charts, images, subreports, crosstabs and much more. Access your data through JDBC, TableModels, JavaBeans, XML, Hibernate, CSV, and custom sources. Then publish your reports as PDF, RTF, XML, XLS, CSV, HTML, XHTML, text, DOCX, or OpenOffice. Through this post, we will tell you how to configure iReport in Mavan base java application(Microservices) project. follows step by step:

  1. Create Spring Boot Java (Microservices)
  2. Create/Design report.jrxml
Create Spring Boot Java (Microservices).
  1. Project Name: I-ReportConfigurationApp
  2. Group:I-Report-a143mk
  3. Artifactid:I-Report-a143mk
  4. Description:Learn I- Report configuration with Microservices Application
  5. Package:I-Report-a143mk




Select the technologies and library(Maven Dependency ) to be.
  1. Spring Web
  2. Spring JPA
  3. Jasperreports
  4. javax.persistence
  5. Tomcat
  6. javax.servlet
  7. mysql
  8. jstl

while creating the project pom.xml file and some maven dependency, main class is automatically created when web add any dependency like.

pom.xml


For step by step development working watch the video and learn yourself. Download wampServer2.0i and install then run it.



1. Create Database: Database Name is hostel.
2. Create Table: Table Name is product.




Configure application.properties


Report:
In src/main/resources/reports/report.jrxml folder, create new folder named reports. In this folder, create new Jasper Report named report.jrxml as below:
 


Code:



Entities Class
Create new package, named IReporta143mk.entities. In this package, create entities class name is Product.java as below:



Create ProductRepository Interface
Create new package named IReporta143mk.repositories. In this package create the ProductRepository interface implements from CrudRepository interface of Spring Data JPA that provides CRUD Operations for an entity.


Create ProductService Interface
Create new package named IReporta143mk.services. In this package create the ProductService interface and ProductServiceImpl as below:
First one is ProductService.java


Second one is ProductServiceImpl.java



Create Controllers
Create new package named IReporta143mk.controllers. In this package, create new java class named ProductController.java


Create jsp page
Create new folder name is jsp. In thes folder /src/main/webapp/WEB-INF/jsp/index.jsp

Structure of Spring Boot Project:


Out Put: