To show how Aspose’s powerful APIs for Java can be used within the Spring Framework, we’ve have extended Spring’s Famous PetClinic Sample Web Application. It highlights some of the benefits of Aspose APIs.
The adapted application adds use cases and sample code that demonstrates some useful Aspose Java API features (using Aspose.PDF, Aspose.Cells, Aspose.Email, Aspose.Words and Aspose.Barcode) within the Spring environment.
Looking at the Aspose for Spring Java (Extension of PetClinic Sample Web Application) you can learn how to integrate Aspose APIs with a Spring MVC-based Java web application and Maven-based Java projects, something which many Java developers want to do.
Aspose.Email for Java Demonstration
The snapshot below demonstrates the integration of the Aspose.Email for Java API with a Microsoft Outlook client:
Spring Java Framework developers can now start using Aspose’s powerful file processing features in their favorite Spring environment with our Java APIs.
You can find a well-designed re-usable OO code in the project source code that will help you integrate Aspose Java APIs easily into your existing or new Spring Java-based projects.
As well as well-designed re-usable OO code that shows how to integrate and use Aspose APIs within a Spring environment, you will find a detailed step-by-step wiki about how to extend Spring Java projects and web applications, integrating Aspose APIs with Maven and Spring MVC controller.
Aspose.BarCode for Java Demonstration
As part of this project, Aspose created a tag library for handy integration of its powerful Aspose.BarCode API features into any Java-based web application, for example web pages or JSP. It’s easy to integrate the tag library into applications because the tag library’s complete source code, with instructions in a wiki, is available through the project repository.
Initialize the Aspose API tag library for your web page with the following taglib directive (for Spring MVC):
For Java web frameworks (still using the Spring Core Framework) other than Spring MVC, initialize the tag library in the web.xml file as below:
Then create the barcode image on page as below:
Aspose for Spring Java (Extension of PetClinic Sample Web Application) demonstrates the following Aspose for Java API features along with the uses cases mentioned above:
- On the Veterinarians Page, availability days and email addresses have been added. Clicking a veterinarian’s email address opens a form where you can write an email and send it through your Outlook client. These features use the Aspose Aspose.Email API.
- On the Veterinarians Page, you can now export a list of vets to PDF, Microsoft Word and Microsoft Excel formats using Aspose APIs (specifically, Aspose.PDF, Aspose.Words, and Aspose.Cells).
- Likewise, on the Owners List page, you can also export a list of vets to PDF, Microsoft Word and Microsoft Excel formats using Aspose APIs (Aspose.PDF, Aspose.Words, Aspose.Cells).
- On the Add Visit Page, you can now enter a feed bill amount in $ which then displays along with the barcode image on the Add Visit and Owners Information pages using the Aspose.BarCode for Java API.
- The export to PDF, Microsoft Word and Microsoft Excel features available on the Veterinarians Owners List pages also shows how Aspose APIs can be used to insert images, apply formatting and create tables to generated documents using Aspose.Words, Aspose.PDF and Aspose.Cells.
- To make it possible to create and display barcode images using Aspose.BarCode on JSP or any MVC Framework using JSP as Views, a tag library - aspose:getBarcodeUrl - has been created. This can be used to easily generate a barcode image and embed it on the page, providing code text, amount and symbology (that is, the barcode type, for example Code128, QR) using tag attributes.
- The complete source code which shows how the above features of the Aspose.Pdf, Aspose.Words, Aspose.Cells, Aspose.Email, and Aspose.BarCode APIs are included in the project repository. It is integrated with the ready to run PetClinic Spring Sample Web Application.
- The source code of the Aspose.BarCode for Java tag library that can be used with JSPs is also included with the project source code. How it can be used is demonstrated on the Add/Edit Visit and Owners Information pages.
- This Spring PetClinic Web Application extension for Aspose API also illustrates Aspose API integration with Maven
You can now start building Spring Java applications or Maven based Java projects with Aspose APIs.
- Aspose Java components
- Detailed wiki on extending Spring MVC web applications
- Detailed wiki on integrating Aspose API with Maven
- Video demo of Aspose API for Spring Java
Source Code Available
Aspose for Spring Java (Extension of PetClinic Sample Web Application) is open source and its source code is available on the social coding websites listed below. Developers can extend the functionality if they want to, or use it to learn how to integrate their own Spring Java applications and projects.