The usual alternative to beanutils

I am looking for an alternative alternative. The reason is that beanutils relies on journaling that contradicts the existing libraries that I use.

I need a small standalone alternative that will not cause any minimal conflicts.

The main functionality that I am is nested property retrieval.

Thanks in advance, Stephen

+6
java apache-commons-beanutils
source share
5 answers

It ended up writing your own mini beanutils to get around this dependency and completely remove Commons-beanutils.

SLF4J did not help, as it broke some other dependencies (hell, you are a weblogic!).

My own implementation is probably slower, as commons-beanutils seem to cache some samples to remove some reflective calls.

Msg me if you are interested in getting the source code of my implementation.

+1
source share

Although property handling is not Jackson's main focus, it can be used for this, like this article .

The main idea is that you can not only read / write JSON to / from POJO, but also perform compatible conversions: including for "serializing" POJO as a Java map. Since you can go back and forth between views, you basically get a bean introspector for free.

Jackson has no external dependencies, but you need both basic (streaming api, impls) and matching banners (data binding).

+6
source share

Jodd has a very good collection of libraries, see if Jodd BeanUtil helps.

+5
source share

You may be able to resolve the conflict by maintaining public records using the alternative logging system provided by SFL4j .

Often, by replacing commons-logging.jar with jcl-over-slf4j.jar, the problems of the class loader related to community logging are immediately and permanently resolved.

+1
source share

If you use Maven, you can eliminate the dependency on public data as follows:

<dependency> <groupId>commons-beanutils</groupId> <artifactId>commons-beanutils</artifactId> <version>1.8.3</version> <exclusions> <exclusion> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> </exclusion> </exclusions> </dependency> 

I did the same with Spring, which also requires a commit. In fact, Spring themselves taught me to exclude it . As far as I can tell, now I have an environment without registration.

Update : for something like SLF4J / Logback, you might also need this in your configuration file:

 <logger name="org.apache.commons" level="OFF" /> 
0
source share

All Articles