Java HowTos Java HowTos

  • Home
  • Blog
  • Categories
  • About
    • Contact
    • Support us

How to convert PFX to JKS file using Keytool?

Details
Super User
Security
Created: 07 July 2019

So, what are JKS and PFX files and why would we want to convert PFX to JKS?

If you're working in Java then the JKS (Java Key Store) is a logically expected place to store private keys. Java applications typically expect to get the keys from JKS, since Java offers ways for easy JKS management. JKS is not easily accessible from outside Java, though.

PFX (PKCS#12) files, on the other hand, are not language-dependent way to store encrypted private keys and certificates, and it has been around long enough so it's widely supported.

Read more...

How to set up basic authentication in Spring Boot

Details
Super User
Security
Created: 19 July 2020

Introduction

In this quick tutorial, we'll show how to set up basic authentication in Spring Boot project using Spring Security. Spring Security offers a lot of security methods and this one is the simplest to configure -when you add Spring Security to your classpath, Basic authentication is enabled by default. The only thing we should do is configure the username and password for our default user.

Read more ...

How to create interceptor in Spring Boot

Details
Maja J
Spring
Created: 20 February 2020

In this quick tutorial, we'll create interceptor in Spring Boot. In Spring, interceptors are used in the following situations:

  • before the request reaches the controller
  • right before the response is sent to the client

Interceptors are useful when you need some sort of request pre-processing or response post-processing, for example - you can add missing field or header to request, or add a header to the response. Another use is request filtering - in case you want to process only requests that contain certain elements or values.

Read more ...

How to seed the database in Spring Boot project?

Details
Super User
Spring
Created: 17 July 2020

Introduction

During development and testing, there's often a need for some initial data in a database that would help us to, for example, try out something or write tests.

In this tutorial, we'll see how to seed the database in the Spring Boot project. Our idea is to first check if the database is really empty, and if it is, to write two User objects. Our code should execute right after the application starts so that we don't need to explicitly invoke it.

We don't need any additional Maven dependency, we'll be using Spring core and Spring data features.

Read more ...

Spring scheduled tasks - @Scheduled annotation

Details
Maja J
Spring
Created: 31 July 2019

 This article will introduce you to the Spring scheduled tasks, show you how to easily set up scheduled tasks in Spring using @Scheduled annotation. We'll also discuss how to configure scheduled tasks in Spring so that they fit your specific needs since they offer a lot of flexibility. We'll go through the following topics:

1. What is a scheduler and how to use @Scheduled annotation in Spring?

2. How to execute methods in sequence with a fixed delay between executions - fixedDelay parameter?

3. How to execute methods on fixed-rate - fixedRate parameter?

4. How to set up cron scheduler and use timezone if needed?

5. How to parametrize the scheduler?

Read more...

The ultimate Spring Boot Rest API beginners guide

Details
Super User
Spring
Created: 27 July 2019

 The main goal of this guide is to show you how to create your firs Spring Boot REST API implementing the Service Layer and Repository pattern.

We'll go through the creation of the following components:

  • setting up project
  • one simple entity
  • controller
  • service
  • repository

Read more ...

Create and download Jasper report xlsx via REST service in Spring Boot

Details
Super User
Data import/export
Created: 17 July 2020

Introduction

Jaspersoft's Jasper reports are popular in Java world since they offer a simple way to design templates and export data into many formats - HTML, PDF, DOCX, XLS, XLSX, CSV, ODT, RTF and ODS.

In this simple tutorial, we'll show how to create a Jasper Excel xlsx report using Java Beans and JRBeanCollectionDataSource and download this report over the REST service using HttpServletResponse. We'll create one simple bean with two attributes - name and color and use it to fill our basic report that will have only these two fields and belonging labels.

Read more ...

The ultimate beginners guide to Java Serverless

Details
Super User
AWS
Created: 18 March 2020

The Serverless framework has become very popular because it's easy to set up and use and it makes the whole AWS Serverless deploying process much easier. It also allows you to test some of AWS features before deployment. This tutorial will guide you through the creation of one simple REST service with AWS Lambda behind the curtains, its testing and its deployment to AWS. We'll also cover the set up of basic dependencies needed for serverless to work. 

Read more ...

Introduction to Selenium - for complete beginners

Details
Maja J
Testing
Created: 05 March 2020

If you're here because you want to start with Selenium, you're in the right place.

This quick start tutorial is intended for complete beginners (no prior Java knowledge is needed), so we will cover project creation, manually add libraries and write code for one simple test scenario that will be executed in Google Chrome.

You'll also learn what are some basic elements of Selenium. If you prefer watching over reading when you study, scroll to the end of this tutorial, we also prepared a quick video guide. So, keep in mind this is plain, simple example without any additional frameworks and optimizations. After you catch up with these basic things, you can optimize, mavenize, etc your project as you wish. 

Read more ...

How to read Gmail using Java and javax.mail

Details
Super User
Libraries
Created: 08 June 2020

Introduction

In this quick example, we'll show how to read Gmail using Java and javax.mail library. We'll use IMAP since it's more flexible than POP3 in terms of folder and message manipulation. We'll read message headers, and after that, we'll mark it as "seen" that will indicate that message is read.

Read more ...

How to fix "Device not managed" issue in Kali Linux?

Details
Super User
Linux
Created: 19 July 2020

Introduction

On the first start of Kali Linux on my Raspberry PI, I plugged in a LAN cable and expected that ethernet will work fine, but, instead, I saw the "Device not managed" message for my eth0. It turns out that from Debian 6.0 (named "squeeze"), the Network Manager does not manage by default any of interfaces defined in /etc/network/interfaces. In this quick tutorial, we'll show how to fix "Device not managed" issue in Kali Linux.

Read more ...

Send an email notification after Jenkins build fails

Details
Super User
CI/CD
Created: 10 August 2020

Jenkins is an open-source automation server that enables developers to build, test, and deploy their software. In this short tutorial, we'll show you how to send an email notification after Jenkins build fails. This is a very common scenario and for the sake of this example, we'll use a built-in Jenkins Mailer plugin. Sometimes is very handy to also send a Slack notification, where the Slack Notification Jenkins plugin is of great help.

Read more ...

Remote Mob Programming - a Real Life Experience

Details
Josh S
Blog
Created: 09 March 2021

1. Introduction

In this article, I'll share my personal experience with remote mob programming, as a senior software developer. There are pros and cons, like with any other software development approach. First, let's see what mob programming is and how did we end up implementing it.

2. What is mob programming?

It's a development approach similar to pair programming where instead of two people you get the whole team to work on one ticket at a time. Sessions last the whole day, and you take breaks when needed. In a remote environment, one person shares a screen and others are watching and contributing then the other person takes over and continues where a previous person stopped. Idea is that every member of the team does some coding. In the normal-life environment, the whole team would gather around one screen and do the same thing.

3. How did we get there?

The company I worked for was going through an agile transition from Scrum to SaFe. Someone sold our management a story that SaFe will solve the company's long-lasting issues. 

We were on some agile meeting when our scrum master just announced that from that moment on we'll be doing mob programming since there is a sentence or maybe a paragraph in their agile handbook that says how mob programming is actually raising a team's efficiency. The whole team was shocked but we're all like, let's try this thing out and then drop it if we don't find it useful. I made few (more or less inappropriate) comments but wanted to see how this will go just out of morbid curiosity.

4. So, how did it look like?

We are all working remote because of the Covid19 situation. Imagine a team consisting of 6 senior and almost senior developers sitting in front of the screen and camera with headphones on for a whole day, while one person is typing at a time. Since that person knows how to work, it's like, binging the job for the others who watch. Others comment here and there or help when a coder gets stuck which does not happen often since we're not kiddies in kindergarten.

From a tooling perspective, we used Google Hangouts for screen sharing.

5. Observations

Efficiency and productivity

So, here we have a situation where one person works and others are watching or helping out. Instead of one ticket that is the result of mob programming, for the same amount of time, in normal circumstances, we would have at least 4 tickets closed (assuming they are of the same weight). In my opinion, this was a waste of time. My productivity was never lower, while my mind was overwhelmed with constant communication.

Also, I had a feeling that, since I'm not the one who's the coding of some functionality from the beginning to the end, I'm getting only some shallow meta-knowledge. Something about me not doing it completely made me feel distant and not completely familiar with the work that is done.

Focus on communication instead of work

When working like this, you're talking most of the time. But, we, old developers, are usually solitary beings. We do our work in our dark cave and we like to get into the flow since this is the rare good feeling this occupation offers. With mob programming, we're even deprived of that. Also, that person which actually does coding needs to verbalize what he/she's doing that is something we developers don't usually do.

Bonding with people

I must admit that mob programming helped my team to bond. We were all employed during the pandemic and started remotely. Some of us never met some other team members. We actually spent a lot of time together online, had some funny conversations, worked, had lunch together. It would be great if we would actually be able to have a similar relationship in real life when the pandemic is over and we start going to the office. Also, I never thought that people's character can leak so much through the way they work. You can see who is detailed, who is picky, etc.

Learning and evaluating the way we work

We had one great guy who was a lot longer in company than the rest of the team. He had more experience with the product we were working on and these sessions were very useful when dealing with parts of the system that only he knew about.

Also, when we watch other people code in real-time, we can actually learn a lot about ourselves, position ourselves in the developer hierarchy and try to improve when we see some practice that is a lot better than ours.

Distractions in a remote environment

When working this way in the normal real-life environment you are actually not on your computer, but doing sessions with others. In a remote environment, you're on your computer where someone is knocking on the door, a neighbor's kid is crying, emails arrive, people are pinging on Slack and you can't ignore it because you have to be sure that nothing is burning where you're the one responsible for it.

So, if you don't turn everything off in these sessions (that last whole day), you would have distractions and it would be not so easy to follow what some other person is doing. Also, if distraction happens just before your coding turn, it would bring you a nice burst of adrenaline. 

6. Conclusion - we decided to drop it

We were doing this for one sprint. On sprint retrospective, we decided not to proceed, except for situations where this is necessary - sometimes there's a need for a whole team to understand or help with some piece.

  • Security (7)

  • Spring (20)

  • Maven (0)

  • Types (4)

  • Drivers (1)

  • Data import/export (12)

  • Web Services (1)

  • AWS (2)

  • Tools (12)

  • Tests and quizzes (1)

  • Other (0)

  • Java versions (1)

  • Testing (4)

  • Docker (4)

  • JPA (3)

  • Spring Cloud (2)

  • Libraries (5)

  • Core Java (2)

  • Linux (7)

  • Java Interview Questions (1)

  • CI/CD (1)

  • JMS (5)

  • Scrum (1)

  • Windows (1)

  • Create Cassandra cluster with Docker Compose
  • Create Cassandra cluster with Docker
  • What is cqlsh and how to use it with Cassandra cluster
  • Understand and configure replication in Cassandra
  • What is Apache Cassandra Replication Factor
  • Basic Nodetool commands used with Cassandra
  • Function - Functional Interface in Java
  • Use Predicate to Filter Stream in Java
  • Read HTTP Headers in Spring REST Controller
  • Java REST Client From Swagger File With OpenAPI Generator
 

EU e-Privacy Directive

This website uses cookies to manage authentication, navigation, and other functions. By using our website, you agree that we can place these types of cookies on your device.

View Privacy Policy

View e-Privacy Directive Documents

View GDPR Documents

You have declined cookies. This decision can be reversed.

You have allowed cookies to be placed on your computer. This decision can be reversed.