- Most popular and the best Java Frameworks, Tools, and Libraries 2016 (August 1, 2016)
- The Most Popular Java Tools for Every Phase of Development (Aug. 15, 16)
- The Top 100 Java Libraries in 2016 - After Analyzing 47,251 Dependencies (May 10, 2016)
Fundamentals
- Java SE 17
- Java SE 12
- Java SE 9
- Java SE 8
- Java SE 7
- Java SE 6
- Java SE 5
- The Java Tutorials
- Java Language and Virtual Machine Specifications
- Java Object Serialization Specification
- Primitive Types and Values
- Java Literals
- Constants and Literals
- java.util.Locale API
- java.util.TimeZone API
- java.time.ZoneId API
- java.util.Currency API
- java.nio.charset.Charset API
- java.nio.charset.StandardCharsets : ISO_8859_1, US_ASCII, UTF_8, UTF_16BE, UTF_16LE, UTF_16
- Intervals, Durations, Periods
- An interval in Joda-Time represents an interval of time from one instant to another instant.
- A duration in Joda-Time represents a duration of time measured in milliseconds. The duration is often obtained from an interval.
- A period in Joda-Time represents a period of time defined in terms of fields, for example, 3 years 5 months 2 days and 7 hours.
- Format String Syntax
- Decimal Format
- Date and Time Patterns (
java.text
package) - Date and Time Patterns (
java.time
package)BASIC_ISO_DATE
('20111203'),ISO_LOCAL_DATE
('2011-12-03'),ISO_OFFSET_DATE
('2011-12-03+01:00'),ISO_LOCAL_TIME
('10:15:30'),ISO_LOCAL_DATE_TIME
('2011-12-03T10:15:30'),ISO_OFFSET_DATE_TIME
('2011-12-03T10:15:30+01:00'),ISO_ZONED_DATE_TIME
('2011-12-03T10:15:30+01:00[Europe/Paris]')- ISO 8601(Wikipedia)
- Message Format (
java.text.MessageFormat
) - Regular Expression
- Properties File Format
- Java HotSpot VM Options
- Getting Started with the G1 Garbage Collector
- The Garbage-First Garbage Collector
- Java command line debug options
- JDWP (Java Debug Wire Protocol) : the protocol used for communication between a debugger and the Java VM.
- JPDA (Java Platform Debugger Architecture)
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000
- 9 Things Java Programmers Should Learn in 2018 (Jan. 19, 18)
- The Good and the Bad of Java Programming (Aug. 28, 18)
- Top 8 Java People You Should Know (August 25, 2010)
- Distributions
- OpenJDK
- Eclipse Temurin : the open source Java SE build based upon OpenJDK
Java EE
Version | Specs | API | Tutorial | Documentation | Remarks |
---|---|---|---|---|---|
Java EE 8 | Java EE 8 Technologies | Java EE 8 Specification APIs | |||
Java EE 7 | Java EE 7 Technologies | Java EE 7 Specification APIs | |||
Java EE 6 | Java EE 6 Technologies | The Java EE 6 Tutorial | |||
Java EE 5 | Java EE 5 Technologies |
Component | Description | Package | Spec | API | Remarks |
---|---|---|---|---|---|
Jakarta Activation | Defines standard services for MIME type data access | Jakarta Activation 2.0 API | |||
Jakarta Annotations | Declarative style annotations for common semantic concepts | ||||
Jakarta Authentication | Low-level container SPI for authentication mechanisms | ||||
Jakarta Authorization | Low-level container SPI for authorization modules | ||||
Jakarta Batch | API plus an XML-based batch job specification language | jakrta.batch |
- J2EE Transaction Propagation Attributes
Required
,RequiresNew
,NotSupported
, ...
- JSP Tutorial
- Be careful with Singleton Session Bean (01/31/2010)
- J2EE Transaction Frameworks: Building the Framework (04/26/2001)
- OpenEjb, Jetty and Maven - Transaction Management
- OpenEjb - Embedded Configuration
API Docs and Sources
Java SE
- Java SE 17 API Specification
- Java SE 15 API Specification
- Java SE 13 API Specification
- Java SE 12 API Specification
- Java SE 11 API Specification
- Java SE 10 API Specification
- Java SE 9 API Specification
- Java SE 8 API Specification
- Java SE 7 API Specification
- Java SE 6 API Specification
- J2SE 5.0 API Specification
- J2SE v1.4.2 API Specification
Class | Method | Description | Remarks |
---|---|---|---|
java.lang.Object |
|||
wait(long timeout) |
|||
clone() |
|||
hashCode() |
|||
finalize() |
|||
java.lang.Runtime |
|||
addShutdownHook(Thread hook) |
|||
java.util.Optional<T> |
Java 8+ |
Java EE
- Java EE 8 Specification APIs
- Java EE 7 Specification APIs
- J2EE 6 API Specification
- J2EE v5.0 API Specifications
- J2EE v1.4 API Specification
Common Libraries
JSRs
JSR | Description | Remarks |
---|---|---|
JSR 94: Java Rule Engine API | Defines a Java runtime API for rule engines. | |
JSR 250: Common Annotations for the Java Platform | Develop annotations for common semantic concepts in the J2SE and J2EE platforms that apply across a variety of individual technologies. | @Resource, @Resources, @PostConstruct, @PreDestroy
|
JSR 303: Bean Validation | Define a meta-data model and API for JavaBean validation based on annotations, with overrides and extended meta-data through the use of XML validation descriptors. | @Null, @NotNull, @Min, @Max, @Size, @Pattern, @Digits, @Future, @Past |
JSR 305: Annotations for Software Defect Detection | Work to develop standard annotations (such as @NonNull ) that can be applied to Java programs to assist tools that detect software defects.
|
@Nonnull, @Nullable, @Immutable, @ThreadSafe, @NotThreadSafe, @WillClose |
JSR 308: Annotations on Java Types | Extends the Java annotation syntax to permit annotations on any occurrence of a type. | Type Annotations Specification |
JSR 330: Dependency Injection for Java | ||
JSR 349: Bean Validation 1.1 | Standardizes constraint definition, declaration and validation for the Java platform. | Bean Validation API 1.1.0.Final |
JSR 352: Batch Applications for the Java Platform | ||
JSR 353: Java API for JSON Processing (JSON-P) | ||
JSR 356: Java API for WebSocket | ||
JSR 380: Bean Validation 2.0 | Aims at evolving the Bean Validation specification by leveraging Java 8 language constructs for the purposes of validation. | @Null, @NotNull, @Min, @Max, @Size, @Pattern, @Digits, @Future, @Past, @NotEmpty, @NotBlank, @Positive, @PositiveOrZero, @Negative, @NegativeOrZero |
- JSR 94: Java Rule Engine API
- Defines a Java runtime API for rule engines.
- Jess 7 API documentation includes JSR94 API
- Getting Started With the Java Rule Engine API (JSR 94): Toward Rule-Based Applications
- JSR 305: Annotations for Software Defect Detection
- Work to develop standard annotations (such as
@NonNull
) that can be applied to Java programs to assist tools that detect software defects. - JSR305 API
- @Nonnull, @Nullable, @Immutable, @ThreadSafe, @NotThreadSafe, @WillClose, ...
- Maven repository » com.google.code.findbugs » jsr305
- Work to develop standard annotations (such as
- JSR 308: Annotations on Java Types
- Extends the Java annotation syntax to permit annotations on any occurrence of a type.
- Type Annotations Specification
- Type Annotations (JSR 308) and the Checker Framework
- Checker Framework API
- The Checker Framework Manual
- Maven repository » edu.washington.cs.types.checker » checker-framework
- JSR 349: Bean Validation 1.1
- Standardizes constraint definition, declaration and validation for the Java platform.
- http://beanvalidation.org
- Bean Validation specification 1.1 Final
- Bean Validation API 1.1.0.Final
- Annotations in Hibernate Validator 5.2
@CreditCardNumber, @Email, @NotBlank, @NotEmpty, @Range, @URL
- Maven repository » javax.validation » validation-api
- Declaring bean constraints (in the reference manual of Hibernate Validator)
Basic
- Why should I use the keyword “final” on a method parameter in Java?
- Does JVM/GC call '
finalize()
' on program/thread exit?(Oct 24 '11) - Implementing in-memory compression for objects in Java
NULL
is the Worst Mistake in Computer Science (Feb. 08, 16)
- Why am I getting unreported exception when the super class default constructor has a 'throws' clause?(Apr 4 '13)
- What is the difference between
NoClassDefFoundError
andClassNotFoundException
?(Sep 22 '09) java.lang.Error
API- That is,
Error
and its subclasses are regarded as unchecked exceptions for the purposes of compile-time checking of exceptions.
- That is,
- Setup ShutdownHook and exit application (Jan 17 '12)
- How to redirect Process Builder's output to a string? (May 23 '13)
Process.destroy()
and shutdown hook platform specific behavior (2001-07-29)- Using Process.destroy() is the last resort, and there is no garantee that shutdown hooks will be run in the case when the process is another VM instance.
- Understanding
sun.misc.Unsafe
(Jan/14/14)- Using unsafe reflection on non-public filed.
- canonical file path in java - optimization problem?(Sep 20 '11)
sun.io.useCanonCaches
,sun.io.useCanonPrefixCache
- Argue against
Pair
class
- Common System Properties
Property | Description | Values | Remarks |
---|---|---|---|
file.encoding | UTF-8 | ||
user.country | KR, US | ||
user.language | ko, en | ||
user.timezone | Asia/Seoul | ||
com.sun.management.jmxremote | N/A | ||
com.sun.management.jmxremote.port | IP port number | ||
com.sun.management.jmxremote.ssl | true, false | ||
com.sun.management.jmxremote.authenticate | true, false | ||
com.sun.management.jmxremote.local.only | true, false |
Data Type
- Integer.valueOf() vs. Integer.parseInt()
- Generating random BigIntegers
- BigInteger(int, Random)
String and Bytes
- What is String literal pool? How to create a String
- What is the Java's internal represention for String? Modified UTF-8? UTF-16?
- Java uses UTF-16 for the internal text representation and supports a non-standard modification of UTF-8 for string serialization.](Mar 14 '12)
String.format
vs.MessageFormat.format
vs. String.+ vs.StringBuilder.append
(September 30, 2009)- Formatting Numeric Print Output
- "%,d", "%10.3f"
- How to convert a byte array to a hex string in Java? (Mar 11 '12)
- Use
static String Hex.encodeHexString(byte[] data)
orstatic char[] Hex.encodeHex(byte[] data)
from Apache Commons Codec
- Use
- Char array to byte array in UTF-8 without using String or Charset (Nov 18 '15)
- String must be avoided, because of security concerns (due to interning or caching)
- What are Java array literals? How to Use Array Literals in Java?
- String response = {"Yes", "No"};
- String response = askQuestion("Do you want to quit?", new String[] {"Yes", "No"});
- Point[] points = { circle1.getCenterPoint(), circle2.getCenterPoint() };
- Java Raw String Literals (Nov 26, 2018) : since Java 12
Typical Code Samples
final byte[][] inputs = {
"Highway Star".getBytes(),
"Crazy Train".getBytes(),
"The Dark Side of the Moon".getBytes(),
"지상에서 영원으로".getBytes()
};
for(byte[] input: inputs) {
...
}
Temporal Data Types
Category | Class | Description | Remarks |
---|---|---|---|
JDK | Date | Represents a specific instant in time, with millisecond precision. | |
Calendar | An abstract class that provides methods for converting between a specific instant in time and a set of calendar fields. | ||
GregorianCalendar | Provides the standard calendar system used by most of the world. | ||
SimpleDateFormat | Formatting (date → text) and parsing (text → date) dates in a locale-sensitive manner | not synchronized (not thread-safe) | |
JDK 8 Date-Time API | Instant | An instantaneous point on the time-line. | stores a long representing epoch-seconds and an int representing nanosecond-of-second |
LocalDate | A date without a time-zone in the ISO-8601 calendar system. | 2007-12-03 | |
LocalDateTime | A date-time without a time-zone in the ISO-8601 calendar system. | 2007-12-03T10:15:30 | |
LocalTime | A time without a time-zone in the ISO-8601 calendar system. | 10:15:30 | |
OffsetDateTime | |||
OffsetTime | |||
ZonedDateTime | |||
ZoneId | A time-zone ID | Europe/Paris | |
ZoneOffset | A time-zone offset from Greenwich/UTC | +02:00 | |
TimeZone | Represents a time zone offset, and also figures out daylight savings. | ||
DateTimeFormatter | Formatter for printing and parsing date-time objects. | A formatter created from a pattern can be used as many times as necessary, it is immutable and is thread-safe. | |
Apache Commons | FastDateFormat | A fast and thread-safe version of SimpleDateFormat | |
FastTimeZone | Faster methods to produce custom time zones. | ||
Spring | @DateTimeFormat | ||
DateTimeFormat.ISO | enum | ||
@JsonFormat |
- Calculating the difference between two Java date instances(Oct 12 '09)
d2.getTime() - d1.getTime()
Typical Code Samples
long epochTime = Instant.now().getEpochSecond(); // get epoch time of now in second
long epochMilli = Instant.now().toEpochMilli(); // get epoch time of now in milli-second
LocalDateTime birthday = LocalDateTime.of(2012, Month.FEBRUARY, 21, 0, 0, 0);
long birthdayEpoch = birthday.atZone(ZoneId.systemDefault()).toEpochSystem(); // `Instant.from` doesn't support `LocalDateTime` class
Concurrency
- Doug Lea's Home Page
- Atomicity, Visibility and Ordering
- How Synchronization works in Java ? Example of synchronized block
- Concurrency series
- Java theory and practice: Introduction to nonblocking algorithms
- Performance of ReentrantLock and Synchronized
- Concurrency in JDK 5.0 (23 Nov 2004)
- Be Lazy With Java 8 (Jan. 26, 16)
final
,synchronized
,volatile
and visibility
- Java Memory Model From a Programmer's Point-of-View (Jul. 27, 10)
- Java Memory Model (2014-12-18)
- What operations in Java are considered atomic? (Jan 21 '11)
- Non-Atomic Treatment of
double
andlong
- a single write to a non-volatile long or double value is treated as two separate writes
- Writes and reads of volatile long and double values are always atomic.
- Writes to and reads of references are always atomic, regardless of whether they are implemented as 32-bit or 64-bit values.
- 5 Tips on Concurrency (Sep. 01, 17)
- Waiting on multiple threads to complete in Java (Sep 1 '09)
- Java 8 concurrency basics (April 08, 2014)
- Java Concurrency: Thread Confinement (Jun. 28, 19)
- Ad-Hoc Thread Confinement, Stack Confinement, ThreadLocal
- Everything I Know About Distributed Locks (Oct. 17, 19)
- Introduction to Concurrent Programming: A Beginner's Guide
- Valueable classes
Classes | Description |
---|---|
java.util.concurrent.locks.Condition
|
Condition factors out the Object monitor methods (wait, notify and notifyAll) into distinct objects to give the effect of having multiple wait-sets per object, by combining them with the use of arbitrary Lock implementations.
|
com.google.common.util.concurrent.Monitor
|
A synchronization abstraction supporting waiting on arbitrary boolean conditions. |
java.util.concurrent.atomic.LongAdder
|
usually preferable to AtomicLong when multiple threads update a common sum that is used for purposes such as collecting statistics |
Annotation
- Package net.jcip.annotations
- Package org.apache.http.annotation : Thread-safety annotations based on JCIP-ANNOTATIONS
- Java 6: Unsupported
@SuppressWarnings("rawtypes")
warning (Sep 5 '10)- lists valid warning types by cases
Annotations | Description | Included |
---|---|---|
java.lang.annotation package
|
@Documented , @Inherited , @Repeatable , @Retention , @Target
| |
Dependency Injection Annotations in Java EE 7 | @Inject , @Named , @Qualifier
| |
JSR 305 Annotations for Software Defect Detection 3.0.1 API | @Nonnull , @Nullable , @Immutable , @ThreadSafe , @NotThreadSafe , @GuardedBy
| |
Bean Validation API 1.0 Annotations | JSR 303: Bean Validation | @Null , @NotNull , @Min , @Max , @Size , @Pattern , @Digits , @Future , @Past
|
Bean Validation API 1.1.0 Annotations | JSR 349: Bean Validation 1.1 | @Null , @NotNull , @Min , @Max , @Size , @Pattern , @Digits , @Future , @Past
|
Bean Validation API 2.0 Annotations | JSR 380: Bean Validation 2.0 | @Null , @NotNull , @Min , @Max , @Size , @Pattern , @Digits , @Future , @Past , @NotEmpty , @NotBlank , @Positive , @PositiveOrZero , @Negative , @NegativeOrZero
|
Hibernate Validator 5.2.4.Final Annotations | ||
Hibernate Validator 6.1 Annotations | ||
Hibernate Validator 7.0 Annotations | ||
Swagger 1.5 Annotations | Annotations for Open API 2.0 | @Api , @ApiOperation , @ApiParam , @ApiModel , @ApiModelProperty
|
Swagger 2.x Annotations | Annotations for Open API 3.0 | @Operation , @Parameter , @RequestBody , @ApiResponse , @Tag , @Scheme
|
- Setting dynamic data to min and max attributes of @Range annotation - hibernate validators (Jun 26 '15)
- The value for annotation attribute must be a constant expression
- Is it possible for class to inherit the annotaions of the super class (May 15 '12)
Class.getAnnotations()
,Class.getDeclaredAnnotations()
,@Inherited
- Is there something like Annotation Inheritance in java? (Oct 13 '11)
- Why is not possible to extend annotations in Java? (Oct 26 '09)
- Is this annotation on the array or on the element type the array? (May 10 '18)
@C int @A [] @B [] f;
Reflection
- Instantiating Objects Of Type Parameter Without Passing Class Literal To Instance
- Java Reflection, but Faster (Sep. 17, 18)
- Invoking a static method using reflection (Mar 18 '10)
- method.invoke(null, "whatever")
- How to create a generic array in Java?
E[] arry = (E[]) Array.newInstance(clazz, len)
API
- java.lang.Class<T>
- java.lang.reflect.Constructor<T>
- java.lang.reflect.Array
- java.lang.invoke.LambdaMetafactory
Class | Method | Description | Remarks |
---|---|---|---|
Array | provides static methods to dynamically create and access Java arrays | ||
static Object newInstance(Class<?> type, int len) | Creates a new array with the specified element type and length. |
Collection
- Outline of the Collections Framework
- How much memory does a Hashtable use?
- String array Initialization in JAVA(Jul 7 '13)
- The Best of Java Collections Tutorials (Dec. 05, 19)
API
Class | Method | Description | Remarks |
---|---|---|---|
Arrays | Contains various methods for manipulating arrays | binarySearch, fill, parallelSort, sort, stream | |
static <T> List<T> asList(T...) | Returns a fixed-size list backed by the specified array. | ||
Collections | Consists exclusively of static methods that operate on or return collections. | binarySearch, min, max, sort, reverse, unmodifiableList, unmodifiableMap | |
static <T> List<T> emptyList() | Returns an empty list (immutable). This list is serializable. | ||
static <K,V> Map<K,V> emptyMap() | Returns an empty map (immutable). This map is serializable. | ||
static <T> List<T> singletonList(T) | Returns an immutable list containing only the specified object. | ||
static <K,V> Map<K,V> singletonMap(K, V) | Returns an immutable map, mapping only the specified key to the specified value. | ||
ArrayUtils | Operations on arrays, primitive arrays (like int[]) and primitive wrapper arrays (like Integer[]). | contains, indexOf, insert, nullToEmpty | |
static Object[] nullToEmpty(Object[]) | Defensive programming technique to change a null reference to an empty one. | ||
CollectionUtils | Provides utility methods and decorators for Collection instances. | ||
ListUtils | Provides utility methods and decorators for List instances. | ||
static <T> List<T> emptyIfNull(List<T>) | Returns an immutable empty list if the argument is null, or the argument itself otherwise. |
https://docs.oracle.com/javase/8/docs/api/java/util/Collections.html#emptyList--
Regex
Generic
- Generics from Java SE 1.5 documentation
- Lesson: Generics from The Java Tutorials
- Lesson: Generics from The Java Tutorials (old)
- Reflecting generics
- Java theory and practice: Generics gotchas
- Diagnosing Java code: Java generics without the pain, Part 1
- How to: generic array creation
- Generic array in ArrayList implimentation
- “Cannot create generic array of ..” - how to create an Array of Map<String, Object>?(Feb 17 '13)
- How do I make the method return type generic? (Jan 16 '09)
- Super Type Tokens (December 04, 2006)
Enum
- Enums in Java Language Specification, Third Edition
- An enum type is implicitly
final
. - Nested enum types are implicitly
static
. - Attempting to explicitly instantiate an enum type : compile-time error
- Reflective instantiation of enum types : prohibited
- Declaring abstract enum type : compile-time error
- Declaring a finalizer for an enum : compile-time error
- Using the == operator in place of the equals method when comparing two object references if it is known that at least one of them refers to an enum constant : permissible
- An enum type is implicitly
- Typesafe Enums from Java SE 1.5 documentation
- Draft spec for a Typesafe Enum Facility
- Bootstrapping static fields within enums
- static fields cannot be accessed within the enum constructor
- Nested Java enum definition - does declaring as static make a difference?
Lambda
- Java Tutorial > Lambda Expressions
- Java SE 8: Lambda Quick Start
- State of the Lambda (September 2013)
- Are Java 8 Lambdas Closures? (11/25/2015)
IO and Networking
- Serialization
java.io.Serializable
API- "A no-arg constructor must be accessible to the subclass that is serializable."
- "it is strongly recommended that all serializable classes explicitly declare serialVersionUID values, ..."
- Java Object Serialization Specification
- "Serialization of inner classes (i.e., nested classes that are not static member classes), including local and anonymous classes, is strongly discouraged for several reasons."
org.apache.commons.lang3.SerializationUtils
API
byte
array to file in Java(Dec 3 '10)org.apache.commons.io.FileUtils.writeByteArrayToFile(), org.apache.commons.io.FileUtils.readFileToByteArray()
- HttpURLConnection’s Dark Secrets
- Java HttpURLConnection (how to open and read a url with Java)
- Java URL and URLConnection example - how to read content from a URL)
- Setting the default Java character encoding?
- Compressing and Decompressing Data Using Java APIs (February 2002)
- Java Compression and Decompression Tutorial (20-09-2014)
- Apache Commons Compress Examples
API
Class | Method | Description | Remarks |
---|---|---|---|
Files |
consists exclusively of static methods that operate on files, directories, or other types of files. | ||
newInputStream(Path, OpenOption...)
|
Opens a file, returning an input stream to read from the file. | safe for access by multiple concurrent threads | |
newOutputStream(Path, OpenOption...)
|
Opens or creates a file, returning an output stream that may be used to write bytes to the file. | safe for access by multiple concurrent threads | |
Paths |
consists exclusively of static methods that return a Path by converting a path string or URI. |
Caching
- Cache Abstraction from reference documentation of Spring Framework 3.1
- Explanation for how to use Guava caches.
XML
- Saxon - Configuration Features
- Parser Features - Apache XML
- 'Processing XML with Java' (Book written by Elliotte Rusty Harold)
- Always explicitly specify which XML parser to use
- Is it a good idea to share a single DocumentBuilder instance accross multiple threads?
DocumentBuilder
is NOT thead-safe
- XML Parser Benchmarks: Part 1 (May 2007)
- Make DocumentBuilder.parse ignore DTD references
- Using Xalan alongside Saxon
- Using Saxons S9API Interface
- How to Validate XML using Java
- The Java XML Validation API from developerWorks (08 Aug 2006)
- XPath 1.0 queries on JAXB objects? (Jun 2010)
- TagSoup and XPath
- Parsing an XML Document with XPath(01/12/2005)
- Using the Java language NamespaceContext object with XPath(19 May 2009)
- XPath and Default Namespace handling
- sample Java codes using Jaxen, JAXP XPathFactory, or XSLT.
- JAXB on Java 9, 10, 11 and beyond (30 SEPTEMBER 2018)
- In Java SE 9 and 10, the module java.se.ee, which contains JAX-WS, JAXB and a few other Java EE APIs, is still included but is deprecated, and not included in the module path by default.
- In Java SE 11, the module java.se.ee has been removed. To use JAX-WS and JAXB you need to add them to your project as separate libraries.
- There are Maven artifacts available for the official JAXB reference implementation.
JDBC
- JDK and JDBC
JDK | JDBC | JSR |
---|---|---|
J2SE 1.4 | JDBC 3.0 | JSR 54: JDBC 3.0 Specification |
Java SE 6 | JDBC 4.0 | JSR 221: JDBC 4.0 API Specification |
Java SE 7 | JDBC 4.1 | |
Java SE 8 | JDBC 4.2 | JSR-000221 JDBC API Specification 4.2 Maintenance Release 2 |
Database | Connection URL | Connection Properties | Drivers | Remarks |
---|---|---|---|---|
Oracle Database | OracleDataSource.setConnectionProperties(java.util.Properties value) |
|||
DB2 | Properties for the IBM Data Server Driver for JDBC and SQLJ | |||
Microsoft SQL Server | jdbc:sqlserver://[serverName[\instanceName][:portNumber]][;property=value[;property=value]]
|
Setting the Connection Properties - SQL Server 2008 R2 | ||
MySQL | jdbc:postgresql://host:port/database[?property=value&property=value...]
|
Driver/Datasource Class Names, URL Syntax and Configuration Properties for Connector/J | MySQL Connectors | |
MariaDB | jdbc:postgresql://host:port/database[?property=value&property=value...]
|
Optional URL Parameters | MariaDB Connector/J | |
PostgreSQL | jdbc:postgresql://host:port/database[?property=value&property=value...]
|
Connection Parameters | PostgreSQL JDBC Driver | |
HSQLDB | Connection properties |
Enum org.springframework.integration.jdbc.config.JdbcTypesEnum
API- What's New in JDBC 4.0?(April 10, 2007)
- Plug memory leaks in enterprise Java applications (Mar 13, 2006)
Oracle Database
- JDBC driver : http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html
- Connection properties
- Diagnosability
IBM DB2
- JDBC driver : http://www-01.ibm.com/support/docview.wss?rs=71&uid=swg21363866
- Connection properties
Microsoft SQL Server
- Connection properties
- Readings
- Microsoft JDBC Driver for SQL Server documentation(MSDN)
- Working with Statements and Result Sets
- ...Limit the Size of Your Result Sets, Use the Appropriate Fetch Size...
- Improving Performance and Reliability with the JDBC Driver
- API
MySQL
- Connection properties
- Driver/Datasource Class Names, URL Syntax and Configuration Properties for Connector/J 5.1
- Note properties such as
maxRows
,serverTimezone
,useAffectedRows
.
- Note properties such as
- Driver/Datasource Class Names, URL Syntax and Configuration Properties for Connector/J 5.1
HSQLDB
- JDBC Driver
- hsqldb » hsqldb : 1.6.x ~ 1.8.x
- org.hsqldb : 2.0.x ~
- Connection URL
- Connection properties
Access
- Connecting to MS Access Files via JDBC in 64-bit Java (July 26th, 2011)
- Microsoft Access Database Engine 2010 Redistributable
jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=...
- connection string of jdbc odbc with MS access (Jan 11 '13)
Security
Java Security
|
|
+------------------ JCA/JCE ------------------+
| Signature Cipher |
| Message Digest Key Agreement |
| Key Script Generator Key Generator |
| Key Factory Secret Key Factory |
| Algorithm Parameters MAC |
| Key Store SPI |
+---------------------------------------------+
|
|
CSP (Cryptographic Service Provider)
|
+---------+--------+-----------+---------+--------+--------+
| | | | | | |
SunPKCS11 SUN SunRsaSign SunJSSE SunJCE SunMSCAPI SunEC
- Java Cryptography Architecture(JCA) Reference Guide
- JCA Standard Algorithm Name Documentation
- Cryptographic Concepts
- Cryptography in Java
- Java SE 12 Security Developer’s Guide
- Java SE 12 JCA Reference Guide
- Java SE 11 Security Developer’s Guide
- Java SE 11 JCA Reference Guide
- Java SE 7 Security Documentation
- JCA Oracle Providers in JDK 7
- Java SE 6 Security Documentation
- JCA Sun Providers in JDK 6
- J2SE 1.5 Security
- Java PKCS11
- Sun PKCS#11 Provider, JSS Provider
- Java Security Architecture Revisited (September 15, 2011)
- Java KeyStores—the gory details (Nov 18 '17)
- Crypto Tools for DevOps: Java KeyStore
- Java Cryptography Api and KeyStorage (Jan 9 2020)
- Keystore type: which one to use? (Jul 18 '12)
- Importing the CA certificate for the Java Runtime Environment of Cognos Analytics
sudo keytool -importcert -alias FooSelfSigned -file ~/certs/foo.crt -keystore $JAVA_HOME/lib/security/cacerts
- default password
keytool -list -keystore $JAVA_HOME/lib/security/cacerts
- How to import a .cer certificate into a java keystore? (Dec 1, 2010)
API
Class | Description | Remarks |
---|---|---|
java.security.Security | centralizes all security properties and common security methods. | manage providers |
java.security.KeyPairGenerator | generate pairs of public and private keys. | Public key cryptography |
javax.crypto.KeyGenerator | provides the functionality of a secret (symmetric) key generator. | Private key cryptography |
javax.crypto.spec.SecretKeySpec | pecifies a secret key in a provider-independent fashion. |
- Signing
A call to a sign method resets the signature object to the state it was in when previously initialized for signing via a call to initSign. That is, the object is reset and available to generate another signature with the same private key, if desired, via new calls to update and sign.
A call to the verify method resets the signature object to its state when it was initialized for verification via a call to initVerify. That is, the object is reset and available to verify another signature from the identity whose public key was specified in the call to initVerify.
JCA Providers
Sun PKCS#11
- Sun PKCS#11 provider : enables existing applications written to the JCA and JCE APIs to access native PKCS#11 tokens.
- Client key provisioning using SoftHSM and Java SunPKCS11
- Creating key pair using java library and storing it in SoftHSM token (Mar 30, 2018)
- Signing CSR using key stored in PKCS11 softhsm keystore (Feb 16, 2018)
- Different types of keystore in Java -- PKCS12 (2015-01-04)
- JEP 131: PKCS#11 Crypto Provider for 64-bit Windows (August 26, 2013)
- Java 9 PKCS#11 support (Apr 03, 2019)
Internationalization
- Java Tutorial > i18n
- Internationalization: Understanding Locale in the Java Platform (September 20, 2005)
user.language
,user.country
,user.variant
- Java's
java.util.TimeZone
(2014-06-23) - Change time zone (Jun 08, 2014)
Formatting
- Java Tutorial > i18n > Formatting > Messages
- Spring Framework's Internationalization using
MessageSource
- Spring Resource bundle with
ResourceBundleMessageSource
example (August 30, 2012)
API
Class | Package | Description | Remarks |
---|---|---|---|
ResourceBundle |
java.util | ||
PropertyResourceBundle |
java.util | ||
MessageFormat |
java.text | ||
MessageSource | org.springframework.context | ||
ResourceBundleMessageSource | org.springframework.context.support | ||
ReloadableResourceBundleMessageSource | org.springframework.context.support |
JMX
- Java SE 7 - Monitoring and Management Using JMX Technology
com.sun.management.jmxremote
,com.sun.management.jmxremote.port
,com.sun.management.jmxremote.ssl
,com.sun.management.jmxremote.authenticate
, ...
- Java SE 1.5 - Monitoring and Management Using JMX
- JMX Specification, version 1.4
- Java Dynamic Management Kit 5.1 Tutorial
- JMX Best Practices > Open MBeans
- Authentication and Authorization in JMX RMI connectors
- Object name and object name pattern
- Enabling built-in JMX agent using system properties
> java MyApplication -Dcom.sun.management.jmxremote.port=3333 \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.authenticate=false
JNI
jni_md.h
jni.h
- JNI Functions
typedef const struct JNINativeInterface *JNIEnv;
- Type Signatures
- JNI Type Mapping
- Visual C++ Fundamental Types
- NIO Support
- Java Programming Tutorial - Java Native Interface (JNI)
- Never miss
--add-stdcall-alias
to preventUnsatisfiedLinkError
- Never miss
- Java programming with JNI(developerWorks, 26 March 2002)
- Advanced topics
- Local vs. global references, JNI's exception handling functions, Multithreading in native methods, Synchronization in native methods
- Advanced topics
- Get object from an object with JNI in C(Apr 3 '13)
- "The final semicolon is part of the signature!"
- NoSuchMethodError on JNI with ArrayList(Apr 19 '13)
- "You're missing a semi-colon on the end of the type signature, ..."
- JNI Tips
- Best practices for using the Java Native Interface(developerWorks, 07 July 2009)
- In JNI, how do I cache the class, methodID, and fieldIDs per IBM's performance recommendations?(May 16 '12)
- Troubles with JavaCpp on Windows
- for R6034 error
- solution : How to: Embed a Manifest Inside a C/C++ Application
- JNI system.loadlibrary problem - native C++ dll using C library(Apr 12 '11)
- NEVER use
'/MDd'
compiler option to preventjava.lang.UnsatisfiedLinkError
caused bymsvcr90d.dll
.
- NEVER use
- jni not support types as void*, unsigned int*, … What to do?(May 27 '11)
- use
jlong
to pass a pointer (or a pointer to pointer, or whatever) back to Java
- use
- JNI Performance - Welcome to the dark side(January 7, 2014)
- Caching jmethodID, jfieldID and jclass
- JNI ASYNCHRONOUS CALLBACKS (January 11, 2012)
- How to obtain JNI interface pointer (JNIEnv *) for asynchronous calls (Oct 15 '12)
- calling java method from c++ using JNI (Mar 12 '12)
- Convert char* to jstring in JNI, when char* is passed using va_arg(Jun 5 '13)
- Memory leak when calling java code from C using JNI (Aug 27 '09)
- ... when you are creating object from a native java-attached thread, it becomes bound to this thread stack frame, which will be destroyed only with this thread. ...
- debugging
- Debugging JNI C and Java code in Eclipse
- Debugging integrated Java and C C++ code
- Failed to execute MI command(13 June 2011)
- Don't forget to toggle on Non-stop mode
- performance
JavaFX
Javadoc
- Automatic Copying of Method Comments
{@inheritDoc}
tag - Java Doclet and Javadoc information presented by Zentech
- Javadocs and UML class diagrams with UMLGraphDoc
- Doclet.Com
Diagnostics
- Remote debugging a Java application (Jun 10 '09)
- Debug Java applications remotely with Eclipse (09 December 2008)
- Java Mission Control (Finally) Released!(September 10, 2013)
- Java Performance Checklist (Jan. 15, 16)
- java.lang.OutOfMemoryError: Unable to create new native thread
- Occasionally you can bypass the Unable to create new native thread issue by increasing the limits at the OS level.
Expression Language (EL)
- JSR 341: Expression Language 3.0
- The Java EE 6 Tutorial > Expression Language
- Unified Expression Language for JSP and JSF(March 7, 2006)
JAX-RS
Version | Spec | API | Remarks |
---|---|---|---|
Jakarta RESTful Web Services 3.0 | JAX-RS 3.0 Spec | JAX-RS 3.0 API | |
Jakarta RESTful Web Services 2.1 | JAX-RS 2.1 API | ||
JSR 339: JAX-RS 2.0 | |||
JSR 311: JAX-RS |
Annotation | Description | Remarks |
---|---|---|
@PathParam
|
Binds the value of a URI template parameter or a path segment containing the template parameter to a resource method parameter, resource class field, or resource class bean property. | |
@QueryParam
|
Binds the value(s) of a HTTP query parameter to a resource method parameter, resource class field, or resource class bean property. | |
@FormParam
|
Binds the value(s) of a form parameter contained within a request entity body to a resource method parameter. | |
@MatrixParam
|
Binds the value(s) of a URI matrix parameter to a resource method parameter, resource class field, or resource class bean property. | |
@HeaderParam
|
Binds the value(s) of a HTTP header to a resource method parameter, resource class field, or resource class bean property. | |
@CookieParam
|
Binds the value of a HTTP cookie to a resource method parameter, resource class field, or resource class bean property. |
Batch
- An Overview of Batch Processing in Java EE 7.0(June 2013)
- Introduction to Batch Processing
- JSR 352: Batch Applications for the Java Platform
API
Package | Classes | Description |
---|---|---|
javax.batch.api package
|
Batchlet , AbstractBatchlet |
|
javax.batch.api.chunk package
|
ItemProcessor , ItemReader , ItemWriter |
|
javax.batch.api.chunk.listener package
|
ItemProcessListener , ItemReadListener , ItemWriteListener |
|
javax.batch.api.listener package
|
JobListener , StepListener |
|
javax.batch.api.partition package |
||
javax.batch.operations package |
||
javax.batch.runtime package
|
JobExecution , JobInstance , StepExecution , BatchStatus |
|
javax.batch.runtime.context package
|
JobContext , StepContext |
Logging
Testing
- Open-source test management tools
- Is there a way to ignore a single FindBugs warning? - edu.umd.cs.findbugs.annotations.SuppressWarnings
- JUnit 4 Vs TestNG -- Comparison
Debugging
- Effective Java Debugging with Eclipse
- Compiling Java code with debugging information (May 20, 2018)
-g
,-g:{lines,vars,source}
,-g:none
javap
: disassemble one or more class files
AOP
Distributions
GraalVM
- Desc. : a high-performance JDK designed to accelerate the execution of applications written in Java and other JVM languages while also providing runtimes for JavaScript, Python, and a number of other popular languages.
- Source :
- GraalVM Documentation
- GraalVM Updater :
gu
- a command-line utility to install and manage optional GraalVM language runtimes and utilities.
- GraalVM JavaScript Implementation :
Graal.js
,Graal.nodejs
misc
- Top 10 JavaCodeGeeks posts for 2010
- Twitter drops Ruby - The Bullshit (Sep 18, 2013)
- Twitter’s Shift from Ruby to Java Helps it Survive US Election (Nov 09, 2012)
- The JVM Architecture Explained (Sep. 02, 16)
- Dynamically change classpath at runtime
- JAR Manifest Specification
- Load properties file in JAR?(May 12 '10)
- Open Source Code Analyzers in Java
- Redistribution of JDK 6
- Silent installation of JDK and JRE
- Silent installation of JRE
- Protect Your Java Code — Through Obfuscators And Beyond(20-Feb-2015)
- How can I set the process name for a Java-program?(Jun 29 '09)
- how to change the name of a Java application process? (May 19 '09)
- Run Console Applications & Batch Files, without any Window, in the background (April 21, 2011)
- Start a java program without the console (Apr 19 '11)
- 4 Techniques for Writing Better Java (Jul. 18, 17)
- Yet 4 More Techniques for Writing Better Java (Feb. 22, 18)
Frameworks
IoC
Spring Framework
Guice
- https://code.google.com/p/google-guice/
- Desc. : a lightweight dependency injection framework for Java 5 and above, brought to you by Google.
- Maven artifacts :
- Sources :
- Readings
Data Access
JPA
References
- HQL and JPQL (Hibernate 5.4 User Guide)
- JPQL - Full Query Language Syntax (Java EE 6 Tutorial)
Annotations
Annotation | Target | Elements | Description | Remarks |
---|---|---|---|---|
@Table |
type | catalog , schema , name , indexes , uniqueConstraints
|
Specifies the primary table for the annotated entity. | |
@Id |
method, field | Specifies the primary key of an entity. | ||
@IdClass
|
type | Class value
|
Specifies a composite primary key class that is mapped to multiple fields or properties of the entity | |
@Basic
|
method, field | fetch , optional
|
The simplest type of mapping to a database column. | @Column
|
@Column
|
method, field | name , nullable , length , precision , scale , unique
|
Specifies the mapped column for a persistent property or field. | |
@JoinColumn
|
method, field | name , referencedColumnName , nullable , @ForeignKey foreignKey
|
Specifies a column for joining an entity association or element collection. | |
@JoinColumns
|
method, field | @JoinColumn[] value , @ForeignKey foreignKey
|
Specifies the mapping for composite foreign keys. | |
@ForeignKey
|
name
|
Used to specify the handling of foreign key constraints when schema generation is in effect. | ||
@Index
|
columnList , name , unique
|
Used in schema generation to specify creation of an index. | @Table.indexes
| |
@Embeddable
|
type | N/A | Specifies a class whose instances are stored as an intrinsic part of an owning entity and share the identity of the entity | |
@EmbeddedId
|
method, field | N/A | Applied to a persistent field or property of an entity class or mapped superclass to denote a composite primary key that is an embeddable class. | @Embeddable , @AttributeOverrides , @AttributeOverride
|
@Embedded
|
method, field | N/A | Specifies a persistent field or property of an entity whose value is an instance of an embeddable class | @Embeddable , @AttributeOverrides , @AttributeOverride
|
@AttributeOverride
|
type, method, field | name , @Column column
|
Used to override the mapping of a Basic (whether explicit or default) property or field or Id property or field. |
|
@AttributeOverrides
|
type, method, field | @AttributeOverride[] value
|
Used to override mappings of multiple properties or fields. | |
@AssociationOverride
|
type, method, field | name , @ForeignKey foreignKey , @JoinColumn[] joinColumns
|
Used to override a mapping for an entity relationship. | |
@AssociationOverrides
|
type, method, field | @AssociationOverride[] value
|
Used to override mappings of multiple relationship properties or fields. | |
@GeneratedValue
|
method, field | strategy , generator |
Provides for the specification of generation strategies for the values of primary keys | AUTO , IDENTITY , SEQUENCE , TABLE
|
@Temporal
|
method, field | value
|
Must be specified for persistent fields or properties of type java.util.Date and java.util.Calendar. | |
@Lob
|
method, field | Specifies that a persistent property or field should be persisted as a large object to a database-supported large object type. | ||
@Inheritance
|
type | strategy
|
Specifies the inheritance strategy to be used for an entity class hierarchy | enum InheritanceType
|
@Access
|
type, method, field | Used to specify an access type to be applied to an entity class, mapped superclass, or embeddable class, or to a specific attribute of such a class. | AccessType.FIELD, AccessType.PROPERTY |
Types
Class | Description | Remarks |
---|---|---|
@TemporalType.DATE
|
Map as java.sql.Date | |
@TemporalType.TIME
|
Map as java.sql.Time | |
@TemporalType.TIMESTAMP
|
Map as java.sql.Timestamp |
Configuration
Category | Property | Type/Values | Default | Description | Remarks |
---|---|---|---|---|---|
Data Source | jakarta.persistence.jdbc.driver |
string | Fully qualified name of the driver class. | ||
jakarta.persistence.jdbc.url |
string | driver-specific URL | |||
jakarta.persistence.jdbc.user |
string | ||||
jakarta.persistence.jdbc.password |
string | ||||
Schema Tooling | jakarta.persistence.schema-generation.scripts.action
|
none , create , drop-and-create , drop |
none
|
Specifies which scripts are to be generated by the persistence provider. | |
jakarta.persistence.schema-generation.scripts.create-target |
string | Specifies either a Writer configured for output of the DDL script or a string specifying the file URL for the DDL script. | |||
jakarta.persistence.schema-generation.scripts.drop-target |
string | Specifies either a Writer configured for output of the DDL script or a string specifying the file URL for the DDL script. | |||
jakarta.persistence.schema-generation.database.action
|
none , create , drop-and-create , drop |
none
|
Specifies the action to be taken by the persistence provider with regard to the database artifacts | ||
jakarta.persistence.schema-generation.create-source
|
metadata , script , metadata-then-script , script-then-metadata |
Specifies whether schema generation commands for schema creation are to be determined based on object/relational mapping metadata, DDL scripts, or a combination of the two. | |||
jakarta.persistence.schema-generation.drop-source
|
metadata , script , metadata-then-script , script-then-metadata |
Specifies whether schema generation commands for schema dropping are to be determined based on object/relational mapping metadata, DDL scripts, or a combination of the two. | |||
jakarta.persistence.schema-generation.create-script-source |
string | Specifies the CREATE script file as either a Reader configured for reading the DDL script file or a string designating a file URL for the DDL script. | HBM2DDL_IMPORT_FILES
| ||
jakarta.persistence.schema-generation.drop-script-source |
string | Specifies the DROP script file as either a Reader configured for reading the DDL script file or a string designating a file URL for the DDL script. | |||
jakarta.persistence.create-database-schemas |
boolean | false
|
Specify whether database schemas used in the mapping model should be created on export in addition to creating the tables, sequences, etc | ||
jakarta.persistence.sql-load-script-source |
string | Specifying a database initialization script to be run as part of schema-export | HBM2DDL_IMPORT_FILES
| ||
Runtime | jakarta.persistence.lock.timeout |
integer | Value in milliseconds for pessimistic lock timeout. This is a hint only. | ||
jakarta.persistence.query.timeout |
integer | Value in milliseconds for query timeout. This is a hint only. |
Readings
- Access Strategies in JPA and Hibernate – Which is better, field or property access?
@Access(AccessType.FIELD)
- The Ultimate Guide on Composite IDs in JPA Entities (21 March 2022)
@Embeddable
/@EmbeddedId
,IdClass
- Inheritance in hibernate where derived class has no associated table
@Inheritance(strategy = InheritanceType.JOINED)
- JPA Queries (JPQL / Criteria)
- Select Specific Columns with JPA Native Query (November 3, 2018)
- How to JOIN unrelated entities with JPA and Hibernate (Sep 20, 2019)
from Customer c inner join Order o on c.id = o.orderedBy
Hibernate
- https://hibernate.org/orm/
- Desc. :
References
- JPA/Hibernate Compatibility
Hibernate | Hibernate Annotations | JPA | Jakarta Persistence | JDK | Remarks |
---|---|---|---|---|---|
Hibernate v6.3 (API) | org.hibernate.annotations
|
Jakarta Persistence 3.1 (API) | Java 11, 17 or 21 | ||
Hibernate v5.6 (API) | JPA 2.2 (API) | Jakarta Persistence 3.0 (API) | JDK 8, 11, 17 or 18 |
Version | Getting Started | User Guide | API | Settings |
---|---|---|---|---|
6.4 | Hibernate 6.4 Getting Started | Hibernate 6.4 User Guide | Hibernate 6.4 API | Hibernate 6.4 Configuration Settings |
5.4 | Hibernate 5.4 User Guide | Hibernate 5.4 API | Hibernate 5.4 Configuration | |
3.3 | Optional configuration |
API
Version | Package | Description |
---|---|---|
6.3 | org.hibernate.annotations
|
A set of mapping annotations which extend the O/R mapping annotations defined by JPA. |
org.hibernate.type
|
A Hibernate Type is a strategy for mapping a Java property type to a JDBC type or types. | |
org.hibernate.dialect
|
Abstracts over the multifarious dialects of SQL understood by the databases supported by Hibernate. |
Annotations
Annotation | Description | Targets | Elements | Remarks |
---|---|---|---|---|
@Type
|
Specifies a custom UserType for the annotated attribute mapping. | value , parameters |
||
@JdbcTypeCode
|
Specifies the JDBC type-code to use for the column mapping. | value |
since 6.0 | |
@ColumnDefault
|
Specifies that a column has a default value specified in DDL. | value |
||
@ColumnDefaults |
||||
@DialectOverride.ColumnDefault
|
Specializes a ColumnDefault in a certain dialect.
|
method, field | Class dialect , @ColumnDefault override |
|
@DialectOverride.ColumnDefaults
|
method, field | @DialectOverride.ColumnDefault[] value |
||
@Comment
|
Specifies a comment that will be included in generated DDL. | table, column | ||
@Check
|
Specifies a check constraint to be included in the generated DDL. | name , constraints |
||
@Checks
|
A list of Checks. | |||
@DialectOverride.Check
|
Specializes a Check in a certain dialect.
|
type, method, field | Class dialect , @Check override |
|
@DialectOverride.Checks
|
type, method, field | @DialectOverride.Check[] value |
Types
Type | SQL Type | Description | Remarks |
---|---|---|---|
YesNoType | CHAR(1), ENUM('Y','N') | 'N'/'n' is false, 'Y'/'y' is true. The uppercase value is written to the database. | yes_no |
SqlTypes |
Defines a list of constant type codes used to identify generic SQL types. | ||
SqlTypes.BIGINT
|
generic SQL type BIGINT |
||
SqlTypes.BLOB
|
generic SQL type BLOB |
||
SqlTypes.BOOLEAN
|
generic SQL type BOOLEAN |
||
SqlTypes.CHAR
|
generic SQL type CHAR |
||
SqlTypes.CLOB
|
generic SQL type CLOB |
||
SqlTypes.DATE
|
generic SQL type DATE |
||
SqlTypes.DECIMAL
|
generic SQL type DECIMAL |
||
SqlTypes.INTEGER
|
generic SQL type INTEGER |
||
SqlTypes.LONG32VARCHAR
|
|||
SqlTypes.LONGVARCHAR
|
generic SQL type LONGVARCHAR |
||
SqlTypes.NUMERIC
|
generic SQL type NUMERIC |
||
SqlTypes.SMALLINT
|
generic SQL type SMALLINT |
||
SqlTypes.TIME
|
generic SQL type TIME |
||
SqlTypes.TIMESTAMP
|
generic SQL type TIMESTAMP |
||
SqlTypes.SMALLINT
|
generic SQL type SMALLINT |
||
SqlTypes.VARCHAR
|
generic SQL type VARCHAR |
Strategies
Class | Description | Remarks |
---|---|---|
interface PhysicalNamingStrategy
|
A set of rules for determining the physical names of objects in a relational database schema from the logical names specified by the object/relational mappings. | |
CamelCaseToUnderscoresNamingStrategy
|
from Spring Boot | |
interface ImplicitNamingStrategy
|
A set of rules for determining the logical name of a mapped relational database object when the mapping for an element of the Java domain model is not explicitly specified, neither in annotations of the Java code, nor in an XML-based mapping document. | |
interface ColumnOrderingStrategy
|
A pluggable contract that allows ordering of columns within table, constraint and user defined type. | |
ColumnOrderingStrategyStandard
|
Standard implementation that orders columns by size and name following roughly this ordering: order by max(physicalSizeBytes, 4), physicalSizeBytes > 2048, name |
Configuration Settings
Setting | Type/Values | Default | Description | Remarks | |
---|---|---|---|---|---|
hibernate.default_catalog |
string |
A default database catalog name to use for unqualified database object (table, sequence, …) names | |||
hibernate.default_schema |
string |
A default database schema (owner) name to use for unqualified database object (table, sequence, …) names | |||
hibernate.column_ordering_strategy |
string | class
|
default |
Used to specify the ColumnOrderingStrategy class to use. | ||
hibernate.type.preferred_boolean_jdbc_type
|
Specifies the preferred JDBC type for storing boolean values. |
Readings
- Hibernate - Configuration
- Configure hibernate (using JPA) to store Y/N for type Boolean instead of 0/1 (Jul 20 '09)
@Type(type="yes_no")
,@Type(type = "org.hibernate.type.YesNoType")
- How to use @JdbcTypeCode annotation from Hibernate 6
- Ordering columns in a Table in JPA/Hibernate (Oct 25, 2023)
List<Column> orderTableColumns(Table table, Metadata metadata);
Tips and Tricks
Customizing mapping between Java types and SQL types for columns
The mapping can be customized through org.hibernate.dialect.Dialect.columnType(int sqlTypeCode)
method.
Below is columnType()
method of org.hibernate.dialect.PostgreSQLDialect
class.
@Override
protected String columnType(int sqlTypeCode) {
switch (sqlTypeCode) {
case TINYINT:
// no tinyint, not even in Postgres 11
return "smallint";
// there are no nchar/nvarchar types in Postgres
case NCHAR:
return columnType(CHAR);
case NVARCHAR:
return columnType(VARCHAR);
// since there's no real difference between TEXT and VARCHAR,
// except for the length limit, we can just use 'text' for the
// "long" string types
case LONG32VARCHAR:
case LONG32NVARCHAR:
return "text";
case BLOB:
case CLOB:
case NCLOB:
// use oid as the blob/clob type on Postgres because
// the JDBC driver doesn't allow using bytea/text via
// LOB APIs
return "oid";
// use bytea as the "long" binary type (that there is no
// real VARBINARY type in Postgres, so we always use this)
case BINARY:
case VARBINARY:
case LONG32VARBINARY:
return "bytea";
// We do not use the time with timezone type because PG deprecated it and it
// lacks certain operations like subtraction
// case TIME_UTC:
// return columnType( TIME_WITH_TIMEZONE );
case TIMESTAMP_UTC:
return columnType(TIMESTAMP_WITH_TIMEZONE);
default:
return super.columnType(sqlTypeCode);
}
}
iBATIS
- Readings
MyBatis
- http://www.mybatis.org/
- Desc. : couples objects with stored procedures or SQL statements using a XML descriptor.
- Maven artifacts : org.mybatis » mybatis
- Source : https://github.com/mybatis/mybatis-3
- References
- Readings
- Issue 414: MapperScannerConfigurer does not work with PropertyPlaceholderConfigurer in 1.0.2 version
- How t send multiple parameters to mybatis xml mapper file? (May 9, 2012)
- How to apply a method to a parameter in MyBatis(Feb 7 '12)
- Calling a function using ognl - parameters are not interpreted...(Feb 11, 2014)
- Sample Application
MyBatis-Spring
- http://mybatis.github.io/spring/
- Desc. : allows MyBatis to participate in Spring transactions, takes care of building MyBatis mappers and SqlSessions and inject them into other beans, translates MyBatis exceptions into Spring DataAccessExceptions, and finally, it lets you build your application code free of dependencies on MyBatis, Spring or MyBatis-Spring.
- Source : https://github.com/mybatis/spring
- Maven artifacts : org.mybatis » mybatis-spring
- References
MyBatis-Spring-Boot-Starter
- http://www.mybatis.org/spring-boot-starter/mybatis-spring-boot-autoconfigure/
- Desc. : help you build quickly MyBatis applications on top of the Spring Boot
- Sources : https://github.com/mybatis/spring-boot-starter
- Maven artifacts
Ebean
- https://github.com/ebean-orm/ebean
- Desc. : an object–relational mapping product written in Java
- Written in : Java
- Sources :
MyBatis Type Handlers for JSR 310: Date and Time API
- https://github.com/mybatis/typehandlers-jsr310
- Desc. : supporting types introduced in JSR 310: Date and Time API.
- Source : https://github.com/mybatis/typehandlers-jsr310
MV*
Stripes
- http://www.stripesframework.org/
- Desc. : a presentation framework for building web applications using the latest Java technologies.
- License : Apache License v2
Integration
- ActiveMQ, Qpid, HornetQ and RabbitMQ in Comparison
- A Concise Comparison of RabbitMQ, ActiveMQ, and ZeroMQ Message Brokers
Apache Camel
- http://camel.apache.org/
- Desc. : empowers you to define routing and mediation rules in a variety of domain-specific languages, including a Java-based Fluent API, Spring or Blueprint XML Configuration files, and a Scala DSL.
- License :
- Sources : https://github.com/apache/camel
- References
Spring Integration
- http://www.springsource.org/spring-integration/
- Desc. : enables lightweight messaging within Spring-based applications and supports integration with external systems via declarative adapters.
- References
ActiveMQ
- http://activemq.apache.org/
- Desc. : the most popular and powerful open source messaging and Integration Patterns server
- License :
- Sources : https://github.com/apache/activemq
- Maven artifacts : org.apache » activemq
- Readings
- ActiveMQ 5.13.3 API
- Using Apache ActiveMQ 4
- Using Apache ActiveMQ 5
- Configurations
- Web Console
- Web Console
WebConsoleStarter
source- Note that how it is decided which
webconsole-*.xml
is loaded.
- Note that how it is decided which
WebConsole-README.txt
- JXM
- POM of
active-mq
module
Networking
Netty
- http://netty.io/
- Desc. : an asynchronous event-driven network application framework for rapid development of maintainable high performance protocol servers & clients.
- License : Apache License 2.0
- Sources : https://github.com/netty/netty
- Maven artifacts : io.netty
- References
- Readings
Apache MINA
- http://mina.apache.org/mina-project/
- Desc. : a network application framework which helps users develop high performance and high scalability network applications easily.
- License: Apache License 2.0
- Sources : https://github.com/apache/mina
- References
Distributed
- Akka vs Storm (25 June, 2013)
Storm
- https://storm.apache.org/
- Desc. : a free and open source distributed realtime computation system
- License :
- Written in :
- Source : https://github.com/apache/storm
- Maven artifacts :
org.apache.storm
References
- Official documentations
- Concepts
- Topologies, Streams, Spouts, Bolts, Tasks, Workers
- Stream groupings
- Shuffle grouping, Fields grouping, Partial Key grouping
- Local Mode
- Distributed RPC
- Concepts
- Java API
defaults.yaml
- Lists and comments all the configuration properties.
worker.childopts
backtype.storm.Config
- Also lists and describes all the configuration properties.
- Command Line Client
Readings
- Running Apache Storm on Windows(DEC 18TH, 2013)
- Error when running any storm main program from Eclipse(4/18/13)
java.net.SocketException: Address family not supported by protocol family: connect
- Understanding the Parallelism of a Storm Topology(OCT 16TH, 2012)
- Apache Storm 0.9 Training Deck and Tutorial(SEP 15TH, 2014)
- Real Time Processing: Storm-Trident vs Spark-streaming
- Monitoring Storm Topologies: Metrics, Best Practices, and Real-World Examples (October 29, 2013)
- Storm, JMX and JMXTrans
- (STORM-126)Add Lifecycle support API for worker nodes
- Apache storm dependency injection
- Stop the Storm cluster?
- Distributed RPC
@Deprecated backtype.storm.drpc.LinearDRPCTopologyBuilder
LinearDRPCTopologyBuilder
is deprecated.- "Trident subsumes the functionality provided by this class, so it's deprecated"
storm.starter.ManualDRPC
Tips and Tricks
JVM arguments for worker process
The followings are from the Visual VM. Memory options, debugging option and JMX options are specified via worker.childopts
in storm.yaml
and others are added by supervisor.
-Xmx256m
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=26711
-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.port=16711
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dlog.level.root=INFO
-Djava.library.path=storm-local\supervisor\stormdist\CalcTopology-16-1440641838\resources\Windows_Server_2012_R2-x86;storm-local\supervisor\stormdist\CalcTopology-16-1440641838\resources;/usr/local/lib:/opt/local/lib:/usr/lib
-Dlogfile.name=CalcTopology-16-1440641838-worker-6711.log
-Dstorm.home=C:\opt\apache-storm-0.10.0-beta1
-Dstorm.conf.file=
-Dstorm.options=
-Dstorm.log.dir=C:\opt\apache-storm-0.10.0-beta1\logs
-Dlogging.sensitivity=S3
-Dlog4j.configurationFile=C:\opt\apache-storm-0.10.0-beta1\log4j2\worker.xml
-Dstorm.id=CalcTopology-16-1440641838
-Dworker.id=0d3f826d-7550-458c-8c0a-dd716f5c0ec8
-Dworker.port=6711
Apache River
- http://river.apache.org/
- Desc. : a toolkit to build distributed systems with
- License : Apache License, Version 2.0
- Readings
Logging
SLF4J
- http://www.slf4j.org/
- Desc. : serves as a simple facade or abstraction for various logging frameworks, e.g. java.util.logging, log4j and logback, allowing the end user to plug in the desired logging framework at deployment time.
- License : MIT license
- Sources : https://github.com/qos-ch/slf4j
- Maven artifacts : org.slf4j
- References
- Readings
Logback
- http://logback.qos.ch/
- Desc. : intended as a successor to the popular log4j project
- License : EPL v1.0 or LGPL 2.1 (http://logback.qos.ch/license.html)
- Written in : Java
- Sources : https://github.com/qos-ch
- Maven artifacts : ch.qos.logback
References
- Variable substitution
- supports scope of '
local
', 'context
', or 'system
' - supports default value
- fully supports variable nesting including value nesting, name nesting and default value nesting
- supports scope of '
- Specifying the location of the default configuration file as a system property
-Dlogback.configurationFile
- Conditional processing of configuration files
- Logback supports conditional processing of configuration files with the help of
<if>
,<then>
and<else>
elements so that a single configuration file can adequately target several environments.
- Logback supports conditional processing of configuration files with the help of
- RollingFileAppender
RollingFileAppender
supports theprudent
mode in conjunction withTimeBasedRollingPolicy
- The
file
property ofFileAppender
cannot be set and must be left blank to enableprodent
mode. - If you choose to omit the
file
property, then the active file will be computed anew for each period based on the value offileNamePattern
.
- Conversion pattern details
- Coloring
- MDC (Mapped Diagnostic Context)
Readings
- Logback – different log file for each thread(February 5, 2015)
- Allow specifying time zone in TimeBasedRollingPolicy's fileNamePattern
- Request Tracing Using Nginx and Spring Boot (Oct. 02, 18)
Log4j
- http://logging.apache.org/log4j/1.2/
- Desc. : a logging library for Java.
- Sources
- References
- Readings
- Log4j FAQ
- Default Initialization Procedure
- log4j - Configuration
- Log4j XML Configuration Primer
- Note that
TimeBasedRollingPolicy
can only be configured with xml, notlog4j.properties
- Note that
log4j-1.2.dtd
- What system properties are checked by log4j?
log4j.debug
,log4j.defaultInitOverride
,log4j.configuration
,log4j.configurationClass
,log4j.ignoreTCL
- Loading Log4j Configuration File at Custom Position(2009-08-15)
- Override log4j.properties (Nov 23 '10)
- Controlling log4j Log Level at Runtime
- It turns out that log4j properties files reference System properties defined at the JVM. The syntax for such references is the familiar
${propertyName}
seen in other contexts
- It turns out that log4j properties files reference System properties defined at the JVM. The syntax for such references is the familiar
- Example Configurations
- Refer the case where the value of
log4j.configruation
starts withfile:/
- Refer the case where the value of
- Log4j: what is threshold
- Each appender can have it's own threshold
- Using
FileNamePattern
,RollingFileAppender
in log4j(Dec 1 '10)- Note that TimeBasedRollingPolicy can only be configured with xml, not
log4j.properties
- Note that TimeBasedRollingPolicy can only be configured with xml, not
Log4j Extra
- http://logging.apache.org/log4j/extras/
- Desc. : additional functionality for log4j 1.2.x.
- References
Log4j 2
- http://logging.apache.org/log4j/2.x/
- Desc. : an upgrade to Log4j that provides significant improvements over its predecessor, Log4j 1.x, and provides many of the improvements available in Logback while fixing some inherent problems in Logback's architecture.
- References
- Configuration
- Property Substitution
- System Properties
log4j.configurationFile
and much more
- Automatic Configuration
log4j2-test.yaml
,log4j2-test.json
,log4j2-test.xml
,log4j2.yaml
,log4j2.json
...
- Configuration
- Readings
-Dlog4j.configurationFile=${bin}/log4j2.xml
is always reported wrong,TKS!- Rescue for "java.net.MalformedURLException: unknown protocol: c" error message
- Log4j2 rc 1 DefaultRolloverStrategy overwrites after 7 files(Jun 13 '15)
- Rescue for "Policies has no parameter that matches element Def aultRolloverStrategy" error message
log4jdbc
- http://code.google.com/p/log4jdbc/
- Desc. : a Java JDBC driver that can log SQL and/or JDBC calls (and optionally SQL timing information) for other JDBC drivers using the Simple Logging Facade For Java (SLF4J) logging system.
Meta
Bean Validation
- http://beanvalidation.org/
- Desc. : provide an object level constraint declaration and validation facility for the Java application developer, as well as a constraint metadata repository and query API.
Readings
Version | JSR | Bean Validation Spec | API | Reference Impl. | Annotations | Remarks |
---|---|---|---|---|---|---|
Jakarta Bean Validation 3.0 | Jakarta Bean Validation 3.0 Spec (Jul. 2020) | API | Hibernate Validator 7.2 | @Null, @NotNull, @Min, @Max, @Size, @Pattern, @Digits, @Future, @Past, @NotEmpty, @NotBlank, @Positive, @PositiveOrZero, @Negative, @NegativeOrZero | ||
Jakarta Bean Validation 2.0 | Jakarta Bean Validation 2.0 Spec (Aug. 2019) | API | Hibernate Validator 6.2 | @Null, @NotNull, @Min, @Max, @Size, @Pattern, @Digits, @Future, @Past, @NotEmpty, @NotBlank, @Positive, @PositiveOrZero, @Negative, @NegativeOrZero | ||
Bean Validation 2.0 | JSR 380 | Bean Validation Spec 2.0 (Aug. 2017) | Hibernate Validator 6.0 | |||
Bean Validation 1.1 | JSR 349 | Bean Validation Spec 1.1 (Apr. 2013) | API | Hibernate Validator 5.1.1 | @Null, @NotNull, @Min, @Max, @Size, @Pattern, @Digits, @Future, @Past | |
Bean Validation 1.0 | JSR 303 | Bean Validation Spec 1.0 (Oct. 2019) | API | Hibernate Validator 4.3 | @Null, @NotNull, @Min, @Max, @Size, @Pattern, @Digits, @Future, @Past |
Hibernate Validator
- http://www.hibernate.org/subprojects/validator.html
- Desc. : the reference implementation for JSR 349 - Bean Validation 1.1 of which Red Hat is the specification lead.
- Written in : Java
- Maven artifacts : org.hibernate » hibernate-validator
- Readings
Cheker Framework
- http://types.cs.washington.edu/checker-framework/
- Desc. : gives a way to create pluggable type-checkers on top of Type Annotations (JSR 308) syntax.
- License : ?
- Maven artifacts : edu.washington.cs.types.checker » checker-framework
- Readings
AOP
AspectJ
- http://eclipse.org/aspectj/
- Desc. : a seamless aspect-oriented extension to the Java programming language
- License : Eclipse Public License - v 1.0
- Written in : Java
- Maven artifacts : org.aspectj
- References
- Official documentations
- The AspectJ Language
- Language Semantics
- Quick Reference
- AspectJ: syntax basics(excerpt from the book of "AspectJ in Action: Practical Aspect-Oriented Programming" by Ramnivas Laddad)
- AspectJ Runtime API
- Java 5 Only Runtime API (refelection and annotations)
- Annotation Based
thisJoinPoin
- Programming Guide/thisJoinPoint
thisJoinPoint
,thisJoinPointStaticPart
,thisEnclosingJoinPointStaticPart
org.aspectj.lang.JoinPoint
APIorg.aspectj.lang.ProceedingJoinPoint
APIorg.aspectj.lang.JoinPoint.StaticPart
APIorg.aspectj.lang.JoinPoint.EnclosingStaticPart
- Programming Guide/thisJoinPoint
- Readings
- @AspectJ cheat sheet(2010/03/20)
- Writing Spring AOP AspectJ Pointcut Expressions With Examples(2015/02/03)
- AspectJ pointcut to method call in specific methods
- using
withincode
andcall
pointcuts
- using
- AspectJ: this() vs. target() (2011-05-05)
privileged aspect
- Using AspectJ for Accessing Private Members without Reflection (April 10, 2012)
- Too complex to just access private fields which can be much more simple. Refer the right previous link.
- aspectj-maven-plugin not weaving if sourceDirectory is set? (Sep 9 '11)
- LTW
- Load-Time Weaving
- AspectJ:Load Time Weaving:Concrete Aspect
- AspectJ:Load Time Weaving:Abstract Aspect
- Load time weaving in AspectJ using
aop.xml
(Jul 23 '10)-Dorg.aspectj.weaver.loadtime.configuration=...
Templating
FreeMarker
- http://freemarker.sourceforge.net/
- Desc. : a "template engine"; a generic tool to generate text output (anything from HTML to autogenerated source code) based on templates.
- License : liberal BSD-style open source license
- Written in : Java
References
Class/Interface/Method | Description | Remarks |
---|---|---|
Class Configuration | The main entry point into the FreeMarker API; encapsulates the configuration settings of FreeMarker, also serves as a central template-loading and caching service. | thread-safe, sharable, expensive and meant to be application-level singletons. |
public void Configurable.setSetting() | Sets a FreeMarker setting by a name and string value. | |
Class Template | Stores an already parsed template, ready to be processed (rendered) for unlimited times, possibly from multiple threads. | thread-safe. |
Settings
Setting | Description | Remarks |
---|---|---|
locale | local codes with the usual format in Java, such as "en_US", or since 2.3.26, "JVM default" | Configurable.setLocale() |
time_zone | With the format as TimeZone.getTimeZone(java.lang.String) defines it. |
Readings
- First steps with FreeMarker
- Accessing static methods and enums
- Using compress directive
- Regular expressions in Freemarker
- Associating output formats with templates
- .ftlh, .ftlx
- Spring Mail – Sending Email with Freemarker HTML Template Example (OCTOBER 23, 2017)
Rule Engine
Drools
- http://www.drools.org/
- Desc. : a Business Rules Management System (BRMS) solution
- License :
- Written in :
- Sources
- Maven artifacts
- Readings
- Maven Project for Drools (November 27, 2014)
- Getting Started with Drools 6.3.0.Final (October 20, 2015)
Testing
- Top 5 Java Test Frameworks for Automation in 2019 (Apr. 05, 19)
- JUnit, JBehave, Serenity, TestNG, Selenide
JUnit
- http://junit.org/
- Desc. : a simple framework to write repeatable tests.
- Sources : https://github.com/junit-team/junit4
- Maven artifacts :
junit » junit
- References
JUnit 5
- http://junit.org/junit5/
- Desc. : the next generation of JUnit
- Sources : https://github.com/junit-team/junit5/
- Maven artifacts :
org.junit » jupiter
References
- Test Instance Lifecycle
- Repeated Tests : @RepeatedTest
- Parallel Execution : @Execution
- JUnit 5 / Maven
- JUnit 5 / Eclipse
Classes/Packages
Class/Package | Description | Remarks |
---|---|---|
@TestInstance | a type-level annotation that is used to configure the lifecycle of test instances for the annotated test class or test interface | TestInstance.Lifecycle.PER_CLASS, TestInstance.Lifecycle.PER_METHOD |
@Executuion | ExecutionMode.CONCURRENT, ExecutionMode.SAME_THREAD | |
@Test | ||
@RepeatedTest | ||
@BeforeAll | signal that the annotated method should be executed before all tests in the current test class | |
@BeforeEach | signal that the annotated method should be executed before each @Test, @RepeatedTest, @ParameterizedTest, @TestFactory, and @TestTemplate method in the current test class | |
@AfterEach | signal that the annotated method should be executed after each @Test, @RepeatedTest, @ParameterizedTest, @TestFactory, and @TestTemplate method in the current test class | |
@AfterAll | signal that the annotated method should be executed after all tests in the current test class | |
@ExtendWith | a repeatable annotation that is used to register extensions for the annotated test class or test method | |
JUnitPlatform | JUnit 4 based Runner which runs tests on the JUnit Platform in a JUnit 4 environment |
Readings
- Spring Boot and JUnit 5 (APRIL 12, 2017)
- Spring Boot + JUnit 5 + Mockito (February 12, 2019)
- Test Your Spring Boot Applications with JUnit 5 (March 28, 2019)
- JUnit 5 with Spring Boot (plus Kotlin) (July 26, 2016)
- Eclipse JUnit 5 support (Jul 15 '16)
- JUnit 5 – Setup (02.01.2017)
- JUnit 5 - An Early Test Drive - Part 1 (Jul 19, 2016)
TestNG
- http://testng.org/
- Desc. : a testing framework inspired from JUnit and NUnit but introducing some new functionalities that make it more powerful and easier to use.
- License : Apache License, Version 2.0
- Maven artifacts : org.testng » testng
- References
- Readings
Mockito
- http://site.mockito.org/
- Desc. : a mocking framework that tastes really good.
- License : MIT License
- Maven artifacts : org.mockito
- Source : https://github.com/mockito/mockito
References
- Mockito 3.3.3 API
- Mockito 3.3.3 Reference
- Mockito 2.19.0 API
- Mockito 2.19.0 Reference
- Mockito 1.9.5 API
- Mockito 1.9.5 Reference
Readings
- Mockito, JUnit and Spring (Jun 6 '12)
- Spring Integration Tests, Part I, Creating Mock Objects
- Note 'Alternative solution'
- Spring Framework 3.2 RC1: New Testing Features (NOVEMBER 07, 2012)
- An example of stubbing with Mockito with TestNG
@InjectMocks
,@Mock
andMockitoAnnotations.initMocks()
method
- Java mockito - how to add return statement in a loop? (Feb 7 '18)
- OngoingStubbing stub = when(...); for(..){ stub = stub.thenThrow(...); }
Springockito
- https://bitbucket.org/kubek2k/springockito/
- Desc. : a small extension to spring that simplifies way of creation mockito mocks in the intergation tests' related context xml files.
- License : MIT license
- Maven artifacts : org.kubek2k
- Readings
- Springockito-annotations
- Testing Spring components with Mockito (15 January 2014)
EasyMock
- http://easymock.org/
- Desc. : provides Mock Objects by generating them on the fly using Java's proxy mechanism.
- License :
- Maven artifacts : org.easymock » easymock
- Source :
- References
- Readings
REST Assured
- http://rest-assured.io/
- Desc. : a Java DSL for simplifying testing of REST based services built on top of HTTP Builder.
- License : Apache License Version 2.0
- Maven artifacts :
io.rest-assured
- Sources : https://github.com/rest-assured/rest-assured
- Readings
RequestSpecBuilder
source- Both
RequestSpecification
andRequestSpecification
are not immutable nor thread-safe, even worse every call ofRequestSpecification.build
would return same object. - Both
RequestSpecification
andRequestSpecification
should be in method local scope.
- Both
Hamcrest
- http://hamcrest.org/JavaHamcrest/
- Desc. : a library of matchers, which can be combined in to create flexible expressions of intent in tests.
- License : BSD License
- Maven artifacts :
org.hamcrest
- Sources : https://github.com/hamcrest/JavaHamcrest
Web Services
Jersey
- https://jersey.java.net/
- Desc. : open source, production quality, framework for developing RESTful Web Services in Java that provides support for JAX-RS APIs and serves as a JAX-RS (JSR 311 & JSR 339) Reference Implementation.
- License :
- Written in : Java
- Maven artifacts : com.sun.jersey
- Source
- Jersey 2.x : https://github.com/jersey/jersey
- Jersey 1.x : https://github.com/jersey/jersey-1.x
- Jersey 1.x JAXB based JSON support sample : https://github.com/jersey/jersey-1.x-old/tree/master/jersey/samples/json-from-jaxb
- References
- Readings
- Listing all Resources, Paths, Verbs to Build an Entry Point/Index for an API (07.24.2013)
- Spring DI support in Jersey
- Sub-Resources with Jersey,Spring, jax-rs(March 2, 2009)
- fantastic but doubtful, needs actual proof
- WADL Support
- Jersey and WADL
- Are there javadoc-like tools to generate RESTful web service apidoc from JAX-RS annotations? (Feb 12 '11)
- Resteasy - generate REST documentation from Javadoc and Annotations (Jan 3 '12)
- javax.annotation.Nonnull annotation in a resource method leads to error on application startup
- How to add CORS support on the server side in Java with Jersey (2014/04/05)
- Outputting Jersey logging to a file?(Sep 21 '10)
Batch
Spring Batch
- http://projects.spring.io/spring-batch/
- Desc. : A lightweight, comprehensive batch framework designed to enable the development of robust batch applications vital for the daily operations of enterprise systems.
- License
- Readings
JBeret
- https://github.com/jberet/jsr352
- Desc. : an implementation of JSR 352 (Batch Applications for the Java Platform).
- License : Eclipse Public License 1.0
- Readings
Security
Apache Shiro
- http://shiro.apache.org/
- Desc. : a powerful and easy-to-use Java security framework that performs authentication, authorization, cryptography, and session management.
- License : Apache License, Version 2.0
- Readings
Libraries
Fundamental
Apache Commons
Module | Description | Sources | Artifacts | Remarks |
---|---|---|---|---|
Lang | https://github.com/apache/commons-lang | |||
Collection | https://github.com/apache/commons-collections | org.apache.commons ≫ commons-collections4 |
||
Text | ||||
Validator | ||||
IO | https://github.com/apache/commons-io | org.apache.commons ≫ commons-math3 | ||
Codec | provides implementations of common encoders and decoders such as Base64, Hex, Phonetic and URLs. | |||
Text | org.apache.commons » commons-text | |||
Math | http://svn.apache.org/viewvc/commons/proper/math/ |
Module | Version | API | Remarks |
---|---|---|---|
Lang | 3.10 | Commons Lang 3.10 API | |
3.3.2 | Commons Lang 3.3.2 API | ||
Collections | 4.1 | Commons Collections 4.4 API | |
4.0 | Commons Collections 4.0 API | ||
3.2.2 | Commons Collections 3.2.2 API | ||
Validator | 1.5.1 | Commons Validator 1.5.1 API | |
1.4.0 | Commons Validator 1.4.0 API | ||
IO | 2.4 | Commons IO 2.4 API | |
Codec | 1.15 | Commons Codec 1.15 API | |
Compress | 1.6-SNAPSHOT | Commons Compress 1.6-SNAPSHOT API | |
Text | 1.7 | Commons Text 1.7 API | |
Math | 3.2 | Commons Math 3.2 API | |
2.2 | Commons Math 2.2 API | ||
Configuration | 2.0-alpha2 | Commons Configuration 2.0-alpha2 API | |
1.10 | Commons Configuration 1.10 API | ||
DBCP | 2.1 | Apache Commons DBCP 2.1 API | |
1.4 | Commons DBCP 1.4 API | ||
Imaging | 1.0-SNAPSHOT | Apache Commons Imaging 1.0-SNAPSHOT API |
Commons Lang
Class | Method | Description | Remarks |
---|---|---|---|
EqualsBuilder | |||
ReflectionToStringBuilder | |||
Validate | assists in validating arguments or states via exclusiveBetween, inclusiveBetween, isTrue, notBlank, notEmpty, or validState methods | ||
ArrayUtils | |||
nullToEmpty(String[]) | |||
nullToEmpty(T[], Class<T[]>) | |||
toString(Object array) | Outputs an array as a String, treating null as an empty array. | Multi-dimensional arrays are handled correctly | |
DateUtils | |||
parseDateStrictly | |||
ExceptionUtils | Provides utilities for manipulating and examining Throwable objects. | ||
wrapAndThrow(Throwable throwable) | Throw a checked exception without adding the exception to the throws clause of the calling method. | ||
RandomUtils | Supplements the standard Random class. | nextInt(), nextLong(), nextBytes(), nextBoolean() | |
RandomStringUtils | Generates random Strings |
Commons Text
Class | Method | Description | Remarks |
---|---|---|---|
WordUtils | Operations on Strings that contain words. | ||
capitalize(String str, char... delimiters) | Capitalizes all the delimiter separated words in a String. Only the first character of each word is changed. | ||
capitalizeFully(String str, char... delimiters) | Converts all the delimiter separated words in a String into capitalized words. | Camel-case |
Commons IO
Package/Class | Description | Remarks |
---|---|---|
org.apache.commons.io.monitor |
||
org.apache.commons.io.FileUtils |
||
org.apache.commons.io.FilenameUtils |
||
org.apache.commons.io.filefilter.DirectoryFileFilter |
Commons DBCP
Package/Class | Description | Remarks |
---|---|---|
org.apache.commons.dbcp2.BasicDataSource |
Commons Collections with Generics
- https://github.com/megamattron/collections-generic
- Desc. : a new version of the popular Jakarta Commons-Collections project that introduces support for Java 1.5 Generics.
- As of Commons Collection 4, generic is supported. So, this forked library seems to be no more updated.
- API docs for the most recent release
Guava
- http://code.google.com/p/guava-libraries/
- Desc. : contains several of Google's core libraries that we rely on in our Java-based projects: collections, caching, primitives support, concurrency libraries, common annotations, string processing, I/O, and so forth.
- Readings
- Packages and Classes
Eclipse Collections
- https://github.com/eclipse/eclipse-collections
- Desc. : a comprehensive collections library for Java.
- License :
Javolution
- http://javolution.org/
- Desc. : a real-time library aiming to make Java or Java-Like/C++ applications faster and more time predictable.
- License : BSD License
Kryo
- https://github.com/EsotericSoftware/kryo
- Desc. : a fast and efficient object graph serialization framework for Java.
- License : BSD
- Sources : https://github.com/EsotericSoftware/kryo
- Maven artifacts :
- References
- Readings
AssertJ
- https://assertj.github.io/doc/
- Desc. : provides a rich and intuitive set of strongly-typed assertions to use for unit testing (either with JUnit or TestNG).
- License : Apache License Version 2.0
- Sources : https://github.com/joel-costigliola/assertj-core
- References
- Readings
Joda Time
- http://www.joda.org/joda-time/
- Desc. : provides a quality replacement for the Java date and time classes.
- License : Apache 2
- Readings
Typesafe Config Library
- https://github.com/typesafehub/config
- Desc. : Configuration library for JVM languages
- License : Apache 2.0
- Maven artifacts : com.typesafe » config
- Eclipse plugin : https://github.com/dragos/typesafe-config-eclipse
ZeroTurnaround ZIP Library
- https://github.com/zeroturnaround/zt-zip
- Desc. : process a large set of large ZIP archives
- License : Apache License Version 2.0
- Maven artifacts : org.zeroturnaround » zt-zip
Concurrency
Prometheus
- http://prometheus.codehaus.org/
- Desc. : a concurrency library for Java 5 and higher and will be released under the MIT license.
Jetlang
- http://code.google.com/p/jetlang/
- Desc. : a complement to the java.util.concurrent package introduced in 1.5 and should be used for message based concurrency similar to event based actors in Scala.
Functional
RxJava
- https://github.com/ReactiveX/RxJava
- Desc. : Apache License 2.0
- License : a Java VM implementation of Reactive Extensions: a library for composing asynchronous and event-based programs by using observable sequences.
Resilience4j
- https://resilience4j.readme.io/
- Desc. : Fault tolerance library designed for functional programming
- License : Apache License 2.0
- Sources : https://github.com/resilience4j/resilience4j
Annotations
Immutables
- https://immutables.github.io/
- Desc. : Java annotation processors to generate simple, safe and consistent value objects
Lombok
- https://projectlombok.org/
- Desc. :
- License : MIT License
- Sources : https://github.com/rzwitserloot/lombok
API
Annotation | Description | Targets | Remarks |
---|---|---|---|
@Getter |
Put on any field to make lombok build a standard getter. | FIELD, TYPE | @Getter(AccessLevel.NONE) |
@Setter |
Put on any field to make lombok build a standard setter. | FIELD, TYPE | @Setter(AccessLevel.NONE) |
@Data |
|||
@Accessors |
A container for settings for the generation of getters and setters. | FIELD, TYPE | chain property |
@With |
Put on any field to make lombok build a 'with' - a withX method which produces a clone of this object (except for 1 field which gets a new value) | FIELD, TYPE | |
@AllArgsConstructor
|
Generates an all-args constructor | TYPE | |
@NoArgsConstructor
|
Generates a no-args constructor. | TYPE | |
@RequiredArgsConstructor
|
Generates a constructor with required arguments. Required arguments are final fields and fields with constraints such as @NonNull. | TYPE | |
@EqualsAndHashCode
|
Generates implementations for the equals and hashCode methods inherited by all objects, based on relevant fields. | TYPE | |
@ToString
|
enerates an implementation for the toString method inherited by all objects, consisting of printing the values of relevant fields. | TYPE | ToString.Include, ToString.Exclude |
Configuration
- Lombok configuration system
lombok.config
Option | Datatype | Default | Description | Remarks |
---|---|---|---|---|
lombok.copyableAnnotations |
list | Lombok will copy any of these annotations from the field to the setter parameter, and to the getter method. | ||
lombok.extern.findbugs.addSuppressFBWarnings |
boolean | false
|
Add the @SuppressFBWarnings annotation which is useful if you want to run FindBugs on your class files.
| |
lombok.addSuppressWarnings |
boolean | true |
Features
Feature | Description | Remarks |
---|---|---|
@Getter and @Setter
|
Never write public int getFoo() {return foo;} again. |
|
@ToString |
||
@Accessors |
||
@With
|
Immutable 'setters' - methods that create a clone but with one changed field. |
Readings
- location of lombok.config file in java project (Jan 5 '18)
- Usually, a user of lombok puts a lombok.config file with their preferences in a workspace or project root directory
Sample Codes
- Spring Data MongoDB domain object with Lombok
@Getter
@Setter
@RequiredArgsConstructor
@Accessors(chain = true)
@Document(collection = "transactions")
public class Transaction implements java.io.Serializable{
@Id
private final String hash;
@Field(name = "block_no")
private long blockNo;
private long index;
private String from;
// denormalized field from account
@Field("from_is_contr")
private boolean fromIsContract;
private String to;
// denormalized field from account
@Field("to_is_contr")
private boolean toIsContract;
@Getter(AccessLevel.NONE)
@Setter(AccessLevel.NONE)
@AccessType(AccessType.Type.FIELD)
@Field(targetType = DECIMAL128)
private BigDecimal value;
public BigInteger getValue() {
return this.value.toBigInteger();
}
public Transaction setValue(BigInteger val) {
this.value = new BigDecimal(val);
return this;
}
@Indexed
private Instant at;
}
Reflection
BCEL
- http://commons.apache.org/proper/commons-bcel/
- Desc. : give users a convenient way to analyze, create, and manipulate (binary) Java class files (those ending with .class).
- License : Apache License
- References
ASM
- http://forge.ow2.org/projects/asm/
- Desc. : a Java bytecode manipulation framework.
- License: BSD License
cglib
- http://cglib.sourceforge.net/
- Desc. : a powerful, high performance and quality Code Generation Library.
- References
Javassist
- http://www.csg.is.titech.ac.jp/~chiba/javassist/
- Desc. : makes Java bytecode manipulation simple.
- License : the triple license of the MPL, the LGPL, and the Apache License.
- References
ReflectASM
- http://code.google.com/p/reflectasm/
- Desc. : a very small Java library that provides high performance reflection by using code generation.
- License : New BSD License
EL
- http://commons.apache.org/proper/commons-ognl/
- Desc. : an expression language for getting and setting properties of Java objects, plus other extras such as list projection and selection and lambda expressions.
- License : Apache License, Version 2.0
Java Expression Language (JEXL)
- http://commons.apache.org/jexl/
- Desc. : a library intended to facilitate the implementation of dynamic and scripting features in applications and frameworks written in Java.
MVEL
- http://mvel.codehaus.org/Home
- Desc. : a powerful expression language for Java-based applications.
- License : Apache 2.0 License.
Parsing
javaparser
- http://code.google.com/p/javaparser/
- Desc. : A Java 1.5 Parser with AST generation and visitor support.
JTidy
- http://jtidy.sourceforge.net/
- Desc. : a Java port of HTML Tidy, a HTML syntax checker and pretty printer.
- License :
- Written in : Java
- Readings
HtmlCleaner
- http://htmlcleaner.sourceforge.net/
- Desc. : open-source HTML parser written in Java.
- License : BSD License
- Written in : Java
- Maven artifacts : net.sourceforge.htmlcleaner » htmlcleaner
- Readings
- API documentation : http://htmlcleaner.sourceforge.net/doc/
- Using XPath Contains against HTML in Java
jsoup
- http://jsoup.org/
- Desc. : a Java library for working with real-world HTML.
- License : MIT license
- Written in : Java
- Maven artifacts : org.jsoup » jsoup
- Readings
- API documentation : http://jsoup.org/apidocs/
Rhino
- https://developer.mozilla.org/en-US/docs/Rhino
- Desc. : an open-source implementation of JavaScript written entirely in Java.
- License : MPL 2.0 License
- Written in : Java
- Maven artifacts : org.mozilla » rhino
- Readings
SnakeYAML
- https://code.google.com/p/snakeyaml/
- Desc. : a YAML parser and emitter for the Java programming language.
- License : the Apache 2.0 license
- Written in : Java
XML
JAXP
- https://jaxp.java.net/
- Desc. : enables applications to parse, transform, validate and query XML documents using an API that is independent of a particular XML processor implementation.
Xerces2
- http://xerces.apache.org/xerces2-j/
- Desc. : high performance, fully compliant XML parsers
- Readings
Xalan
- http://xalan.apache.org/
- Desc. : an XSLT processor for transforming XML documents into HTML, text, or other XML document types.
- Readings
JAXB
- https://jaxb.java.net/
- Desc. : an XML to Java Binding standard.
- References
- Articles
- Performance and thread-safety : JAXBContext class is thread safe, but the Marshaller, Unmarshaller, and Validator classes are not thread safe.
- JAXB & Collection Properties
- Case Insensitive Unmarshalling with JAXB
- Parent pointers
EclipseLink MOXy
- http://www.eclipse.org/eclipselink/moxy.php
- Desc. : enables Java developers to efficiently bind Java classes to XML Schemas.
- License :
- References
Saxon
- http://saxon.sourceforge.net/
- Desc. : a collection of tools for processing XML documents.
- License : MPL for Home Edition
- Written in : Java
- Maven artifacts : net.sf.saxon » Saxon-HE
- References
- Readings
Jaxen
- http://jaxen.codehaus.org/
- Desc. : an open source XPath library written in Java.
- License : Apache-style open source license
- Written in : Java
- Maven artifacts : jaxen » jaxen
- Readings
PsychoPath
- http://wiki.eclipse.org/PsychoPathXPathProcessor
- Desc. : an XPath 2.0 processor based originally on the 2004/10 version of the XPath 2.0 specification.
- Readings
Woodstox
- http://woodstox.codehaus.org/
- Desc. : a high-performance validating namespace-aware StAX-compliant (JSR-173) Open Source XML-processor written in Java.
- License : LGPL 2.1 and ASL 2.0
JARV
- http://iso-relax.sourceforge.net/JARV/
- Desc. : a vendor-neutral, implementation-independent and schema language independent interface for validators.
- License : MIT
- Readings
MSV
- https://msv.java.net/
- Desc. : a Java technology tool to validate XML documents against several kinds of XML schemas.
- License : BSD
ph-schematron
- https://github.com/phax/ph-schematron
- Desc. : Java library for ISO Schematron validation + Maven plugin for precompilation
- License : Apache License 2.0
- Written in : Java
- Maven artifacts
- com.phloc » phloc-schematron ( ~ 2.6.5)
- com.helger » ph-schematron (2.8.0 ~ )
- Readings
xqpretty
- https://code.google.com/p/xqpretty/
- Desc. : An XQuery pretty printer/formatter.
- License : Apache License 2.0
JSON
Jackson
- http://wiki.fasterxml.com/JacksonHome
- Desc. : JSON processor (JSON parser + JSON generator) written in Java.
- License : Apache License 2.0 or LGPL 2.1
- Written in : Java
- Sources : https://github.com/FasterXML
- Maven artifacts
References
- Deserialization Features
- ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT (default: false)
- ACCEPT_EMPTY_STRING_AS_NULL_OBJECT (default: false)
Category | Class | Type | Description | Remarks |
---|---|---|---|---|
Core | ObjectMapper | class | Provides functionality for reading and writing JSON, either to and from basic POJOs (Plain Old Java Objects), or to and from a general-purpose JSON Tree Model (JsonNode), as well as related functionality for performing conversions. | fully thread-safe provided that ALL configuration of the instance occurs before ANY read or write calls. |
JsonParser.Feature | enum | Defines all on/off features for parsers. | ||
JsonGenerator.Feature | enum | Defines all togglable features for generators. | ||
SerializationFeature | enum | Defines simple on/off features that affect the way Java objects are serialized. | ||
SerDe | DeserializationFeature | enum | Defines simple on/off features that affect the way Java objects are deserialized from JSON. | |
MapperFeature | enum | Defines simple on/off features to set for ObjectMapper, and accessible (but not changeable) via ObjectReader and ObjectWriter | ||
StdSerializer<T> | class | Base class used by all standard serializers, and can also be used for custom serializers (in fact, this is the recommended base class to use). | ||
StdDeserializer<T> | class | Base class for common deserializers. | ||
DateSerializer | class | For efficiency, we will serialize Dates as longs, instead of potentially more readable Strings. | ||
DateDeserializers | class | Container class for core JDK date/time type deserializers. | CalendarDeserializer, DateDeserializer, TimestampDeserializer | |
LocalDateSerializer | class | Serializer for Java 8 temporal LocalDates. | ||
LocalDateTimeSerializer | class | Serializer for Java 8 temporal LocalDateTimes. | ||
LocalDateDeserializer | class | Deserializer for Java 8 temporal LocalDates. | ||
LocalDateTimeDeserializer | class | Deserializer for Java 8 temporal LocalDateTimes. | ||
Annotation | @JsonSerialize | annotation | Configuring serialization aspects, by attaching to "getter" methods or fields, or to value classes. | |
@JsonDeserialize | annotation | Configuring deserialization aspects, by attaching to "setter" methods or fields, or to value classes. | ||
@JsonProperty | annotation | Define a non-static method as a "setter" or "getter" for a logical property (depending on its signature), or non-static object field to be used (serialized, deserialized) as a logical property. | ||
@JsonAlias | annotation | Define one or more alternative names for a property, accepted during deserialization as alternative to the official name. | ||
@JsonTypeInfo | annotation | Configuring details of if and how type information is used with JSON serialization and deserialization, to preserve information about actual class of Object instances. | polymorphic types | |
@JsonUnwrapped | annotation | Indicate that a property should be serialized "unwrapped" |
Jackson 2.9
Jackson 2.8
Jackson 2.6
Jackson 2.2
Jackson 1.9
Modules
Readings
Databinding
- Processing model: Data Binding
- Using JAXB annotations with Jackson
- Jackson Annotations
- jackson-databind/README
- jackson-databind/Wiki
- jackson-annotations/README
- jackson-annotations/Wiki
- jackson-module-jaxb-annotations/README
- Jackson Annotations for JSON (November 29, 2017)
Category | Annotation | Description | Remarks |
---|---|---|---|
Serialization Annotations | @JsonValue | Tells Jackson to use this method to generate the JSON string from the Java object. | method level |
@JsonSerialize | Tells Jackson to use the declared custom serializer during the serialization of the field, which is marked with this annotation. | ||
Deserialization Annotations | @JsonCreator | Tells Jackson that the JSON properties can be mapped to the fields of a constructor of the POJO. | |
@JsonDeserialize | Tells Jackson to use a custom deserializer while deserializing the JSON to Java object. | ||
General Annotations | @JsonProperty | Used to map property names with JSON keys during serialization and deserialization. | |
@JsonFormat | |||
@JsonUnwrapped |
SerDe
- Jackson enum Serializing and DeSerializer(Sep 18 '12)
- Every day Jackson usage, part 1: Immutable objects (August 20, 2010)
- Immutables JSON serialization
- Jackson polymorphic deserialization
- Deserialize JSON with Jackson into Polymorphic Types - A Complete Example(2011-05-25)
- Decode Base64 with Jackson(Nov 16 '12)
- Deserialization of Base64 encoded string into byte array is built-in or implicit.
- Jackson – Custom Serializer (July 22, 2018)
- Spring Boot LocalDate field serialization and deserialization (Jun 16 '15)
- @JsonDeserialize(using = LocalDateDeserializer.class)
- @JsonSerialize(using = LocalDateSerializer.class)
- @JsonFormat(pattern = "dd/MM/yyyy")
- Jackson @JsonProperty and @JsonAlias Example (March 11, 2018)
misc
- Check if JSON is valid in JAVA using Jackson (Apr 2 '15)
- Correctly handle JSR-310 (java 8) dates with Jackson (02 Feb 2016)
JSON-java
- https://github.com/stleary/JSON-java
- Desc. : a reference implementation that demonstrates how to parse JSON documents into Java objects and how to generate new JSON documents from the Java classes.
- License :
- Written in : Java
- Maven artifacts : org.json » json
jsonp
- https://jsonp.java.net/
- Desc. : open source reference implementation of JSR 353 - Java API for JSON Processing
- License : CDDL - Version 1.1 and GPL Version 2
- Written in : Java
- Maven artifacts : org.glassfish » javax.json
- Readings
Jayway JsonPath
- https://github.com/json-path/JsonPath
- Desc. : a Java port of Stefan Goessner JsonPath implementation.
- License : Apache License 2.0
google-gson
- https://code.google.com/p/google-gson/
- Desc. : A Java library to convert JSON to Java objects and vice-versa
- License : Apache License 2.0
- Written in : Java
json-schema-validator
- https://github.com/fge/json-schema-validator
- Desc. : A JSON Schema validation implementation in pure Java.
- License : LGPLv3
- Maven artifacts : com.github.fge » json-schema-validator
- Readings
Testing
Java Faker
- https://github.com/DiUS/java-faker
- Desc. : generates fake data.
jFairy
- https://github.com/Codearte/jfairy
- Desc. : Java fake data generator
- License : Apache License 2.0
Scheduling
Quartz
- http://www.quartz-scheduler.org/
- Desc. : a richly featured, open source job scheduling library that can be integrated within virtually any Java application - from the smallest stand-alone application to the largest e-commerce system.
- License : Apache 2 License
- Maven artifacts
- Sources : https://github.com/quartz-scheduler/quartz
Networking
Apache HttpComponents
- http://hc.apache.org/
- Desc. : a toolset of low level Java components focused on HTTP and associated protocols.
- License : Apache License
- Maven artifacts : org.apache ≫ httpcomponents
References
- Wiki
- HttpClient API
- HttpCore API
- HttpClient Quick Start
- HttpClient Tutorial
- HttpClient 3.x Optimization Guide
API
Class | Package | Description | Remarks |
---|---|---|---|
HttpHeaders | javax.ws.rs.core | An injectable interface that provides access to HTTP header information. | |
HttpHeaders | org.apache.http | Constants enumerating the HTTP headers. | RFC1945 (HTTP/1.0), RFC2616 (HTTP/1.1), RFC2518 (WebDAV) |
MediaType | javax.ws.rs.core | An abstraction for a media type. | |
ContentType | org.apache.http.entity | Content type information consisting of a MIME type and an optional charset. |
Readings
- How do I upload a file to a pre-signed URL in AWS using java? (Oct 11 '18)
- org.apache.http.impl.client.HttpClient, org.apache.http.client.methods.HttpPut, application/octet-stream
OkHttp
- https://square.github.io/okhttp/
- Desc. : an HTTP client that’s efficient by default
- Sources :
- Readings
- OkHttp 3.x API
JSch
- http://www.jcraft.com/jsch/
- Desc. : a pure Java implementation of SSH2
- License : BSD style license
- Readings
- JSch API
- com.jcraft.jsch.JSchException: UnknownHostKey (Jan 5 '10)
StrictHostKeyChecking
Connectivity
c3p0
- http://www.mchange.com/projects/c3p0/
- Desc. : easy-to-use library for making traditional JDBC drivers "enterprise-ready" by augmenting them with functionality defined by the jdbc3 spec and the optional extensions to jdbc2.
- License : LGPL v.2.1 or the EPL v.1.0
- Maven artifacts : com.mchange » c3p0
HikariCP
- https://github.com/brettwooldridge/HikariCP
- Desc. : a "zero-overhead" production ready JDBC connection pool.
- License : Apache-2.0 license
- Written in : Java
TransactionsEssentials
- http://www.atomikos.com/Main/TransactionsEssentials
- Desc. : open source transaction management with JTA/XA and connection pooling for self-contained applications outside of the application server
- License : Apache license, second version.
Jolokia
- https://jolokia.org/
- Desc. : remote JMX with JSON over HTTP.
- License : Apache License Version 2.0
- Sources : https://github.com/rhuss/jolokia
SAP JCo
- http://help.sap.com/saphelp_nwce711/helpdata/en/48/7080a5872c1b5ae10000000a42189c/frameset.htm
- Desc. :can set up communication between external (non-SAP) Java application and AS ABAP.
- Readings
Security
Jasypt
- http://www.jasypt.org/
- Desc. : a java library which allows the developer to add basic encryption capabilities to his/her projects with minimum effort, and without the need of having deep knowledge on how cryptography works.
- License : Apache License 2.0
Readings
- Easy usage: the utils
- General Usage
- Advanced configuration
- JASYPT: Java Simplified Encryption 1.9.0 API
Bouncy Castle
- http://www.bouncycastle.org/
- Desc. : a collection of APIs used in cryptography providing APIs for both the Java and the C# programming languages.
- License : MIT license
- Sources : https://github.com/bcgit/bc-java
References
- API
API
ECDSA
Class | Description | Remakrs |
---|---|---|
BCECPrivateKey | ||
BCECPublicKey |
Readings
- Encryption in Java with JCA and Bouncy Castle API (September 17, 2018)
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("ECDSA", "BC");
ECGenParameterSpec ecGenParameterSpec = new ECGenParameterSpec("secp256k1");
keyPairGenerator.initialize(ecGenParameterSpec, random);
Spongy Castle
- https://github.com/rtyley/spongycastle
- Desc. : a repackage of Bouncy Castle for Android (which ships a crippled version of BC)
- License :
Java JWT
- https://java.jsonwebtoken.io/
- Desc. : the easiest library for creating and verifying JSON Web Tokens (JWTs) on the JVM.
- License :
- Sources : https://github.com/jwtk/jjwt
- Maven artifacts : io.jsonwebtoken
Readings
IAIK PKCS#11 Wrapper
- https://jce.iaik.tugraz.at/sic/Products/Core_Crypto_Toolkits/PKCS_11_Wrapper
- Desc. : a library for the Java platform which makes PKCS#11 (also known as Cryptoki) modules accessible from within Java.
- License : Apache-style license
- Sources : https://github.com/xipki/pkcs11wrapper/releases (fork)
Readings
Image Processing
JavaCV
- https://github.com/bytedeco/javacv
- Desc. : Java interface to OpenCV and more
- License : Apache License Version 2.0
- Sources : https://github.com/bytedeco/javacv
- Maven artifacts : org.bytedeco ≫ javacv
- Readings
ImgLib2
- http://imglib2.net/
- Desc. : a general-purpose, multidimensional image processing library.
- License :
- Written in :
- Sources : https://github.com/imglib/imglib2/
- Readings
JCodec
- http://jcodec.org/
- Desc. : an open source pure java implementation of video and audio codecs and formats.
- License :
- Sources : https://github.com/jcodec/jcodec
- Maven artifacts : org.jcodec ≫ jcodec
- Readings
Xuggler
- http://www.xuggle.com/xuggler/
- Desc. : the easy way to uncompress, modify, and re-compress any media file (or stream) from Java.
- License : LGPL or GPL
- Written in : Java
- Sources : https://github.com/artclarke/xuggle-xuggler
- Readings
Humble Video
- https://github.com/artclarke/humble-video
- Desc. : Demuxing, Decoding, Filtering, Encoding and Muxing of 100's of video and audio formats and Codecs from the JVM
- License : AGPL
- Sources : https://github.com/artclarke/humble-video
- Maven artifacts : io.humble
imgscalr
- https://github.com/thebuzzmedia/imgscalr
- Desc. : Simple Java image-scaling library implementing Chris Campbell's incremental scaling algorithm as well as Java2D's "best-practices" image-scaling techniques.
- License : Apache 2 License
- Readings
Marvin
- http://marvinproject.sourceforge.net/
- Desc. : Pure Java cross-platform image processing framework
- License : LGPL
- Sources
- Readings
vlcj
- http://capricasoftware.co.uk/#/projects/vlcj
- Desc. : provides Java bindings and an application framework for the excellent VLC media player from VideoLAN
- License : GPL, version 3
- Sources : https://github.com/caprica/vlcj
- Maven artifacts : uk.co.caprica » vlcj
- Readings
- vlcj 3.5.0 API Documentation
uk.co.caprica.vlcj.player.headless
package- Provides the classes necessary to support the use of native media players that do not render video output locally - for example streaming servers.
- vlcj 3.5.0 API Documentation
Graphics
JGraphX
- https://github.com/jgraph/jgraphx
- Desc. : java graph visualization and layout component
- License : BSD license
- User manual : http://jgraph.github.com/mxgraph/docs/manual_javavis.html
- API documentation : http://jgraph.github.com/mxgraph/java/docs/
JFreeChart
- http://www.jfree.org/jfreechart/
- Desc. : makes it easy for developers to display professional quality charts in their applications.
JGoodies
- http://www.jgoodies.com/
- Desc. : offers freeware, products, and services for Java desktop developers.
Native
JNA
- https://github.com/twall/jna
- Desc. : provides simplified access to native library methods without requiring any additional JNI or native code.
- License : dual-licensed under 2 alternative Open Source/Free licenses: LGPL 2.1 and Apache License 2.0. (starting with JNA version 4.0.0)
- Sources : https://github.com/twall/jna
- Maven artifacts : net.java.dev.jna
- References
- Readings
- Open source Java projects: Java Native Access(JavaWorld, Feb 5, 2008)
- Java Native Access (JNA)(3 October 2011)
- Developing using native libraries
- Java Code Examples:
com.sun.jna.Memory
- JNA, JNI and Raw Java Performance(25 May 2012)
JavaCPP
- https://github.com/bytedeco/javacpp
- Desc. : the missing bridge between Java and native C++
- License : Apache License, Version 2.0
- Sources : https://github.com/bytedeco/javacpp
- Maven artifacts : org.bytedeco ≫ javacpp
- Readings
misc
JUNG
- http://jung.sourceforge.net/
- Desc. : a software library that provides a common and extensible language for the modeling, analysis, and visualization of data that can be represented as a graph or network.
GEF
- http://gef.tigris.org/
- Desc. : to build a graph editing library that can be used to construct many, high-quality graph editing applications.
- License : BSD License
SIGAR
- http://sourceforge.net/projects/sigar/
- Desc. : a cross-platform, cross-language library and command-line tool for accessing operating system and hardware level information in Java, Perl and .NET.
SvnClientAdapter
- http://subclipse.tigris.org/svnClientAdapter.html
- Desc. : a high-level Java API for Subversion.
- License : Apache License Version 2.0
- Sources : SvnClientAdapter 0.9.4 sources
- Binaries : http://subclipse.tigris.org/servlets/ProjectDocumentList?folderID=1926&expandFolder=1926&folderID=2240
Vavr
- http://www.vavr.io/
- Desc. : a functional library for Java 8+ that provides persistent data types and functional control structures.
- License : Apache License Version 2.0
- Sources : https://github.com/vavr-io/vavr
- Readings
Tools
Compiler Generator
ANTLR
- http://www.antlr.org/
- Desc. : powerful parser generator for reading, processing, executing, or translating structured text or binary files.
- License : BSD License
- References
- Readings
JavaCC
- https://java.net/projects/javacc
- Desc. : a parser/scanner generator for java
- License : BSD
JBurg
- http://jburg.sourceforge.net/
- Desc. : a compiler construction tool that is often used in the compiler's back end to convert a tree-structured representation of a program into machine code.
- License : Common Public License
Janino
- https://janino-compiler.github.io/janino/
- Desc. : a super-small, super-fast Java compiler.
Decompiler
JD Project
- http://jd.benow.ca/
- Desc. : aims to develop tools in order to decompile and analyze Java 5 “byte code” and the later versions.
- License :
JODE
- http://jode.sourceforge.net/
- Desc. : a java package containing a decompiler and an optimizer for java
- License : LGPL
CFR
- https://www.benf.org/other/cfr/
- Desc. : decompile modern Java features - including much of Java 9, 12 & 14
- License : MIT
- Sources : https://github.com/leibnitz27/cfr
Bytecode Viewer
- https://github.com/mstrobel/procyon
- Desc. : a lightweight user-friendly Java/Android Bytecode Viewer, Decompiler & More.
- License : GPL 3.0
Obfuscator
ProGuard
- http://proguard.sourceforge.net/
- Desc. : a free Java class file shrinker, optimizer, obfuscator, and preverifier.
- License : GPL version 2
- Maven artifacts : net.sf.proguard
yGuard
- http://www.yworks.com/en/products_yguard_about.html
- Desc. : a free Java bytecode obfuscator and shrinker that improves your software deployment by prohibiting unwanted access to your source code and drastically shrinking the processed Jar files at the same time.
- License :
Code Analysis
FindBugs
- https://spotbugs.github.io/
- Desc. : a program which uses static analysis to look for bugs in Java code.
- License : LGPL
- Source : https://github.com/spotbugs/spotbugs
Readings
Plug-ins
- fb-contrib
- http://fb-contrib.sourceforge.net/
- Desc. : an extra detector plugin to be used with the static bug finder FindBugs
- License : LGPL v2.0
- Maven artifacts : com.mebigfatguy.fb-contrib » fb-contrib
- Readings
- Find Security Bugs
- https://find-sec-bugs.github.io
- Desc. : The SpotBugs plugin for security audits of Java web applications.
- License : LGPL-3.0
- Sources : https://github.com/find-sec-bugs/find-sec-bugs/
- Maven artifacts : com.h3xstream.findsecbugs » findsecbugs-plugin
- Readings
- findbugs-slf4j
- https://github.com/eller86/findbugs-slf4j
- Desc. : helps you to verify your product which uses SLF4J.
- Maven artifacts : jp.skypencil.findbugs.slf4j
- findbugs-for-android
- https://code.google.com/p/findbugs-for-android/
- Desc. : Findbugs plugin for Android specific coding.
PMD
- https://pmd.github.io/
- Desc. : a static ruleset based Java source code analyzer that identifies potential problems.
- License : BSD-style
- Sources : https://github.com/pmd/pmd
References
- Built-in ruleset files
Readings
- PMD-Intellij / Use Xpath 2.0
<property name="version" value="2.0"/>
ruleset.xslt
- an example to convert PMD ruleset XML file into HTML.
SonarQube
- https://www.sonarqube.org/
- Desc. : an automatic code review tool to detect bugs, vulnerabilities, and code smells in your code.
- Sources : https://github.com/SonarSource/sonarqube
References
Parameter | Description | Remarks |
---|---|---|
sonar.host.url |
the server URL | |
sonar.login |
the authentication token or login of a SonarQube user with Execute Analysis permission on the project. | |
sonar.projectKey |
the project's unique key | |
sonar.projectName |
name of the project that will be displayed on the web interface. |
JDepend
- http://www.clarkware.com/software/JDepend.html
- Desc. : Traverses Java class file directories and generates design quality metrics for each Java package.
- Readings
Checkstyle
- http://checkstyle.sourceforge.net/
- Desc. : Development tool to help programmers write Java code that adheres to a coding standard.
- Readings
Rat
- http://creadur.apache.org/rat/
- Desc. : a release audit tool, focused on licenses.
- License : Apache
JavaNCSS
- http://www.kclee.de/clemens/java/javancss/
- Desc. : a simple command line utility which measures two standard source code metrics for the Java programming language.
- License : GPL
- Written in : Java
- Maven plugin : Maven 2 JavaNCSS Plugin
- Ant tasks : JavaNCSS Ant Task
Launcher
WinRun4J
- http://winrun4j.sourceforge.net/
- Desc. : a java launcher for windows.
- License : Common Public License (CPL)
Monitoring and Diagnostic
VisualVM
- https://visualvm.github.io/
- Desc. : Visual tool integrating several commandline JDK tools and lightweight profiling capabilities.
Readings
- VisualVM 1.2 Adds Powerful New Performance and Memory Profiler
- Visual VM “not supported for this JVM” on all local applications?(May 24 '11)
- Load VisualVM using 64bit JVM via
--jdkhome
option.
- Load VisualVM using 64bit JVM via
- Visual VM - MBeans Tab
- Connecting to JMX Agents Explicitly
- Java VisualVM - Browsing a Heap Dump
- Accessing local actuator JMX endpoints using VisualVM (Apr 6 '18)
- bootRun {jvmArgs = ["-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false"] }
NetBeans Profiler
- https://profiler.netbeans.org/
- Desc. : a module to provide a full-featured profiling functionality for the NetBeans IDE.
- Readings
Java Mission Control
- http://www.oracle.com/technetwork/java/javaseproducts/mission-control/
- Desc. : enables developers and administrators to collect and analyze data from Java applications running locally or deployed in production environments.
- License :
- Readings
- Java Mission Control Introduction (Eclipse Newsletter)
IBM Health Center
- http://www.ibm.com/developerworks/java/jdk/tools/healthcenter/
- Desc. : enables you to assess the current status of a running Java application.
- Readings
BTrace
- https://github.com/btraceio/btrace
- Desc. : a safe, dynamic tracing tool for the Java platform.
- License : GPL-2.0
- Readings
Jolokia
- https://jolokia.org/
- Desc. : remote JMX with JSON over HTTP
- License : Apache License, Version 2.0
jmxtrans
- http://www.jmxtrans.org/
- Desc. : a tool which allows you to connect to any number of Java Virtual Machines (JVMs) and query them for their attributes without writing a single line of Java code.
- License : MIT
- Sources : https://github.com/jmxtrans/jmxtrans
- Maven artifacts : org.jmxtrans
- Readings
- Samples
Tester.java
- Using API including
Server
,Query
andJmxProcess
- Using API including
TreeWalker3.java
- Using API and *dummy writer*.
hawtio
- http://hawt.io/
- Desc. : a modular web console for managing your Java stuff
- License : Apache License, v2.0
- Sources :
- Maven artifacts
Metrics
- http://metrics.dropwizard.io/
- Desc. : a powerful toolkit of ways to measure the behavior of critical components in your production environment.
- License : Apache Software License 2.0
- Written in : Java
- Sources : https://github.com/dropwizard/metrics
- Maven artifacs :
- Readings
Dump Analysis
jhat
- http://docs.oracle.com/javase/6/docs/technotes/tools/share/jhat.html
- Desc. : parses a java heap dump file and launches a webserver.
IBM HeapAnalyzer
- https://www.ibm.com/developerworks/community/groups/service/html/communityview?communityUuid=4544bafe-c7a2-455f-9d43-eb866ea60091
- Desc. : Analyzes Java heap dumps by parsing the Java heap dump, creating directional graphs, transforming them into directional trees, and executing the heuristic search engine.
- Readings
Eclipse Memory Analyzer
- http://www.eclipse.org/mat/
- Desc. : Fast and feature-rich Java heap analyzer that helps you find memory leaks and reduce memory consumption.
- Readings
IBM Thread and Monitor Dump Analyzer for Java
- https://www.ibm.com/developerworks/community/groups/service/html/communityview?communityUuid=2245aa39-fa5c-4475-b891-14c205f7333c
- Desc. : Analyzes javacore and diagnoses monitor locks and thread activities in order to identify the root cause of hangs, deadlocks, and resource contention or monitor bottlenecks.
ThreadLogic
- http://java.net/projects/threadlogic/
- Desc. : builds upon the popular TDA (Thread Dump Analyzer) by adding logic for common patterns found in application servers.
- License: LGPL-2.1
- Readings
Thread Dump Analyzer
- http://java.net/projects/tda
- Desc. : Analyzes Thread Dumps of Sun, SAP and JRockit (partial).
GCViewer
- https://github.com/chewiebug/GCViewer
- Desc. : a little tool that visualizes verbose GC output generated by Sun / Oracle, IBM, HP and BEA Java Virtual Machines.
- License : LGPL
IBM Pattern Modeling and Analysis Tool for Java Garbage Collector
- https://www.ibm.com/developerworks/community/groups/service/html/communitystart?communityUuid=22d56091-3a7b-4497-b36e-634b51838e11
- Desc. : parses verbose GC trace, analyzes Java heap usage, and recommends key configurations based on pattern modeling of Java heap usage.
- License :
IBM Monitoring and Diagnostic Tools - Garbage Collection and Memory Visualizer
- http://www.ibm.com/developerworks/java/jdk/tools/gcmv/
- Desc. : a tool which allows you to visualize and analyse the memory usage and garbage collection activity of your Java or JavaScript application.
Installer
IzPack
- http://izpack.org/
- Desc. : A widely used tool for packaging applications on the Java platform.
Security
KeyStore Explorer
- https://keystore-explorer.org/
- Desc. : an open source GUI replacement for the Java command-line utilities keytool and jarsigner.