Java HowTos Java HowTos
  • Home
  • 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 ...

  • Security (7)

  • Spring (19)

  • Maven (0)

  • Types (4)

  • Drivers (1)

  • Data import/export (12)

  • Web Services (1)

  • AWS (2)

  • Tools (6)

  • Tests and quizzes (1)

  • Other (0)

  • Java versions (1)

  • Testing (4)

  • Docker (2)

  • JPA (3)

  • Spring Cloud (2)

  • Libraries (5)

  • Core Java (0)

  • Linux (5)

  • Java Interview Questions (1)

  • CI/CD (1)

  • JMS (4)

  • NPM exit status 137 when building a Docker image
  • Solved: cannot kill Docker container - permission denied
  • Change hostname on Ubuntu Linux
  • Get health, readiness and liveness information from within an application code
  • Difference Between Request Scope and Session Scope in Spring
  • The Spring Bean Scopes Explained
  • Main Differences between Bean Factory and Application Context in Spring
  • Send JMS message to RabbitMQ queue with Spring Boot
  • Solved umet dependencies - libc6-dev breaks libgcc-9-dev
  • Troubleshoot, fix and enable Bluetooth on Kali Linux