Home » Java (page 3)

Java

Expression-Based Access Control

spring-interview-questions-answers

1. Overview Today, we’ll be reviewing the differences between Expression-Based Access Control (EBAC), Role Based Access Control (RBAC), and Attribute Based Access Control (ABAC), with a deeper focus on EBAC. 2. What is Expression-Based Access Control? Simply put, Expression-Based Access Control is the use of expressions to write authorization. The phrase Expression-Based Access Control (EBAC) is currently most commonly associated ...

Read More »

Compact Number Formatting Comes to JDK 12

JDK 12 Early Access Build 24 introduces support for Compact Number Formatting. The JDK-8188147 (Compact Number Formatting support) CSR‘s “Summary” is the simple sentence, “Adding support for the compact/short number formatting in JDK.” That same CSR also provides a detailed “Solution” section that provides background on providing numbers in multiple compact forms for each Locale and the constructs/APIs added to the JDK to support this ...

Read More »

Validating external data with an Oracle

I hang out in the Corda Slack channel quite a lot and try to answer questions when I can. A reasonable number of questions I have attempted to answer are related to Oracles. More specifically, when to use one. I feel like I can answer that, “Use an Oracle when you need to validate external data that can change frequently”. ...

Read More »

Java 11: Running single-file programs and “shebang” scripts

In Java 11, the java launcher has been enhanced to run single-file source code programs directly, without having to compile them first. For example, consider the following class that simply adds its arguments: import java.util.*; public class Add { public static void main(String[] args) { System.out.println(Arrays.stream(args) .mapToInt(Integer::parseInt) .sum()); } } In previous versions of Java, you would first have to ...

Read More »

Native microservices with SparkJava and Graal

Microservices written with SparkJava are just plain Java code using a standard Java library. No annotation magic, just code. The advantage of this simple style of programming is that it is, well, simple. It’s so simple that the Graal native compiler just compiles it without blinking, something which is currently very difficult with more complex frameworks like Spring, for example. ...

Read More »

Spark Run local design pattern

Many spark applications have now become legacy applications and it is very hard to enhance, test & run locally. Spark has very good testing support but still many spark applications are not testable. I will share one common error that appears when you try to run some old spark applications. Exception in thread "main" org.apache.spark.SparkException: A master URL must be ...

Read More »

A brief overview of the Fork/Join Framework in Java

Introduction The Fork/Join framework is a framework to solve a problem using a concurrent divide-and-conquer approach. They were introduced to complement the existing concurrency API. Before their introduction, the existing ExecutorService implementations were the popular choice to run asynchronous tasks, but they work best when the tasks are homogenous and independent. Running dependent tasks and combining their results using those ...

Read More »

Java: Streaming a JDBC ResultSet as CSV

spring-interview-questions-answers

In my previous post, I showed how to convert a java.sql.ResultSet to JSON and stream it back to the caller. This post, is about streaming it in CSV format instead. Streaming allows you to transfer the data, little by little, without having to load it all into the server’s memory. For example, consider the following ResultSet: +---------+-----+ | Name | ...

Read More »