Skip to main content

Posts

Showing posts with the label Spring

Running Spring Boot Web App on the Random Port from Port Range

By default the spring boot web application is listening on the port 8080 for the incoming connection. This behavior can be changed by providing server.port property value during starting of the application or as part of the application.properties or through the code by implementing EmbeddedServletContainerCustomizer. But it would be even better if we could specified a range of the ports which can be used for the starting the application. It would be great if I could specify a property like server.portRange=8100..8200 to define a list of the port on which I want to start my service. In this blog post I will describe how this can be done.

Clean code with aspects

In my previous post I've described the alphabet conversion, and I've mentioned that we used AspectJ to resolve that task, but i did not mention how AspectJ works and what are aspects generaly. So in the next few lines i will explain: what is Aspect Oriented Programming and why we need it what is AspectJ using AspectJ with Spring (configuring AspectJ and spring to work together) and i will explain aspects on the example from previous post.

Alphabets Conversion

In one of company's last projects we supposed to implemented support for usage of Latin and Cyrillic alphabet. This could sounds like an easy task, the Java have a real good support for the multi language application, but what is with languages which have multiple alphabets. When I said supporting more alphabets, I mean on possibility of choosing between different keybord layouts, not only on showing messages from different properties files, also content saved in database should be transformed from one to other alphabet. To accomplish these requirements, we made few decisions. We've decided to save data in Latin form and then transform it in Cyrillic if it is needed. This also mean that complete input from user side will be transformed to latin alphabet. I've almost forgot to mention technologies used in this project. It is a web application, devloped with next technologies: JSP + Servlet for front end Spring + Hibernate as backend and it is running on Tomcat 6 ...

Simple Workflow Engine With Spring

Few months ago, during working on one of the company project, we had need to developed  REST services which is used for sending an email depending on data sent by client application. During developing this service we decide to create simple workflow engine which will be charged for sending an email, but also this engine can be used for any kind of simple flows. In this article i will explain step by step how you can implement your simple workflow engine which can handle sequence flow.