The Simple Logging Facade for Java or (SLF4J) 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.
Before you start using SLF4J, we highly recommend that you read the two-page SLF4J user manual.
In case you wish to migrate your Java source files to SLF4J, consider our migrator tool which can migrate your project into SLF4J in minutes.
In case an externally-maintained component you depend on uses a logging API other than SLF4J, such as commons logging, log4j or j.u.l, have a look at SLF4J's binary-support for legacy APIs.
XStream is a simple library to serialize objects to XML and back again.
Features
Ease of use. A high level facade is supplied that simplifies common use cases.
No mappings required. Most objects can be serialized without need for specifying mappings.
Performance. Speed and low memory footprint are a crucial part of the design, making it suitable for large object graphs or systems with high message throughput.
Clean XML. No information is duplicated that can be obtained via reflection. This results in XML that is easier to read for humans and more compact than native Java serialization.
Requires no modifications to objects. Serializes internal fields, including private and final. Supports non-public and inner classes. Classes are not required to have default constructor.
Full object graph support. Duplicate references encountered in the object-model will be maintained. Supports circular references.
Integrates with other XML APIs. By implementing an interface, XStream can serialize directly to/from any tree structure (not just XML).
Customizable conversion strategies. Strategies can be registered allowing customization of how particular types are represented as XML.
Error messages. When an exception occurs due to malformed XML, detailed diagnostics are provided to help isolate and fix the problem.
Alternative output format. The modular design allows other output formats. XStream ships currently with JSON support and morphing.
As Eclipse plug-in and Rich Client Platform developers, we face unique challenges in how we structure and execute our unit tests. In this article, I suggest an approach to unit testing based on Eclipse fragments that can help us overcome these challenges. If you find yourself frustrated with your current plug-in testing options, read on!
But before going into detail on a fragment based solution, let's examine the current approaches and the pros and cons associated with each. The first approach is the one most of us start with as we learn the ropes of plug-in development: placing all code in a single plug-in.
FTP Server written in pure Java. Supports AUTH SSL (Explicit SSL), it is firewall friendly (handles the CCC command), has virtual home directories with individual read/write access, anoymous support and many more
"Out of the box Jersey generates basic WADL at runtime that you can obtain from your REST app via GET http://path.to.your/restapp/application.wadl. Additionally you can configure Jersey to create an extended WADL including e.g. additional doc elements or javadoc read from your resource classes: There's a custom doclet that writes your javadoc to a file so that it can be used to extend the WADL. Additionally there's the maven-wadl-plugin that allows you to create the WADL without your running REST app."
Jettison is a collection of Java APIs (like STaX and DOM) which read and write JSON. This allows nearly transparent enablement of JSON based web services in services frameworks like CXF or XML serialization frameworks like XStream.
There are currently two included conventions for mapping JSON to XML. The first, is BadgerFish which implements the full XML infoset in JSON using various techniques. The second, is called the "mapped" convention. It allows you to manually map XML namespaces to JSON element prefixes.
Jettison was developed for usage in XFire and CXF to enable JSON based services. Later it also found its place in Java object serialization with XStream
To learn more, see the User's Guide.
Bndtools is an Eclipse-based development environment for OSGi bundles and applications that focuses on:
Ease of use and a rapid development lifecycle;
Encouraging OSGi best practices;
Producing accurate bundle metadata to maximise re-usability;
Integration with offline build tools and users of other IDEs.
See Features for a summary of Bndtools features.
Bndtools is based on Bnd, the powerful bundle tool created by Peter Kriens. Please read Why Bndtools? to learn why Bndtools has been created and why you should use it for OSGi development in Eclipse.
and it is still there even after the program finished. Let’s see if we can read that file once again, this time without creating it first.
Now, let’s see what happens, when we change the serialVersionUID value and try to deserialize once again our file. Change the line 2 in the class SerializeMe so that serialVersionUID contains now 2 instead of 1:
Exception in thread "main" java.io.InvalidClassException:
As you can see, this time the deserialization didn’t go well. ObjectInputStream complained about the serialVersionUID being changed.
How does he know that it changed? If serialVersinUID is static, then it should not have been serialized in the first place, and there should be no information about the previous value 1 during the deserialization, right? Well, serialVersionUID is an exception to the rule that “static fields don’t get serialized”.
Moreover, if there is no serialVersionUID officially declared in the class to be serialized, compiler automatically adds it with a value generated based on the fields declared in the class.
The deserialization of that object does not necessarily have to occur exactly after serialization. It can occur after a few months or on a completely different JVM
there is a chance that the class declaration has changed between serialization and deserialization.
It checks if the data read from the input stream is compatible with the current definition of the class.
when the visibility of a field changes, the serialVersionUID changes too.
sometimes you just want for some reason to forbid deserialization of old serialized objects,
you might tend to write it once for every serializable class ( or have it generated by the IDE ) and forget about it. WRONG !!!
If you write it once and don’t take care to update it when necessary, you loose all the merits of serialVersionUID.
Typically, your repository interface will extend
Repository,
CrudRepository or
PagingAndSortingRepository.
Alternatively, if you do not want to extend Spring Data interfaces,
you can also annotate your repository interface with
@RepositoryDefinition
It allows quick
query definition by method names but also custom-tuning of these
queries by introducing declared queries as needed.
CREATE_IF_NOT_FOUND (default)CREATE_IF_NOT_FOUND combines CREATE
and USE_DECLARED_QUERY.
the first
By acts as delimiter to indicate the start of the actual
criteria
The mechanism strips the prefixes
find…By, read…By, and get…By
from the method and starts parsing the rest of it
you can define conditions on entity
properties and concatenate them with And and Or
The introducing
clause can contain further expressions such as a Distinct
to set a distinct flag
List<Person> findByEmailAddressAndLastname(EmailAddress emailAddress, String lastname);
// Enables the distinct flag for the query
List<Person> findDistinctPeopleByLastnameOrFirstname(String lastname, String firstname);
List<Person> findPeopleDistinctByLastnameOrFirstname(String lastname, String firstname);
// Enabling ignoring case for an individual property
List<Person> findByLastnameIgnoreCase(String lastname);
// Enabling ignoring case for all suitable properties
List<Person> findByLastnameAndFirstnameAllIgnoreCase(String lastname, String firstname);
// Enabling static ORDER BY for a query
List<Person> findByLastnameOrderByFirstnameAsc(String lastname);
List<Person> findByLastnameOrderByFirstnameDesc(String lastname);
You can combine
property expressions with AND and OR.
You also get support for operators such as
Between, LessThan,
GreaterThan, Like for the
property expressions
AllIgnoreCase
IgnoreCase
The resolution algorithm starts with interpreting the entire part
(AddressZipCode) as the property and checks the
domain class for a property with that name (uncapitalized). If the
algorithm succeeds it uses that property. If not, the algorithm splits
up the source at the camel case parts from the right side into a head
and a tail and tries to find the corresponding property, in our
example, AddressZip and Code.
he
infrastructure will recognize certain specific types like
Pageable and
Sort to apply pagination and sorting to your
queries dynamically
Pageable
Sort sort
The first method allows you to pass an
org.springframework.data.domain.Pageable instance to the
query method to dynamically add paging to your statically defined
query. Sorting options are handled through the
Pageable instance too
Spring is instructed to scan
com.acme.repositories and all its subpackages for
interfaces extending Repository or one
of its subinterfaces. For each interface found, the infrastructure
registers the persistence technology-specific
FactoryBean to create the appropriate
proxies that handle invocations of the query methods. Each bean is
registered under a bean name that is derived from the interface name,
so an interface of UserRepository would
be registered under userRepository
This postfix defaults to
Impl.Example 1.12. Configuration example<repositories base-package="com.acme.repository" />
<repositories base-package="com.acme.repository" repository-impl-postfix="FooBar" />The first configuration example will try to look up a class
com.acme.repository.UserRepositoryImpl to act
as custom repository implementation, where the second example will try
to lookup
com.acme.repository.UserRepositoryFoo
To exclude an interface that extends
Repository from being instantiated as
a repository instance, you can either annotate it with
@NoRepositoryBean or move it outside
of the configured base-package.
]In general, the integration support is enabled by using the
@EnableSpringDataWebSupport annotation in
your JavaConfig configuration class.
@Configuration
@EnableWebMvc
@EnableSpringDataWebSupport
class WebConfiguration { }
In case you need multiple
Pageables or
Sorts to be resolved from the request (for
multiple tables, for example) you can use Spring's
@Qualifier annotation to distinguish
one from another
Spring HATEOAS ships with a representation model class
PagedResources that allows enrichting the content of a Page instance
with the necessary Page metadata as well as links to let the clients
easily navigate the pages.