Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check which jackson library is being used

Tags:

java

jackson


I need to run a test over a JEE application using com.fasterxml.jackson.core library to determine which version of jackson API has been loaded in memory. I took a look at its API but I couldn't find so far any static class.method returning an instance of com/fasterxml/jackson/core/Version.java Can you advice me a way to check the library version being used ? Thanks

like image 516
Carla Avatar asked Oct 30 '17 08:10

Carla


1 Answers

Version class appears to be in use in most public components of Jackson, e.g.:

ObjectMapper om = new ObjectMapper();
Version version = om.version();
System.out.println(version);

or

Version version = com.fasterxml.jackson.databind.cfg.PackageVersion.VERSION;
System.out.println(version);

or

Version version = com.fasterxml.jackson.core.json.PackageVersion.VERSION;
System.out.println(version);

Look for classes implementing com.fasterxml.jackson.core.Versioned interface, which provides the version() method.

like image 144
Henrik Aasted Sørensen Avatar answered Sep 22 '22 13:09

Henrik Aasted Sørensen