All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openbp.config.context.StandardContextObjectSerializerConfig Maven / Gradle / Ivy

There is a newer version: 0.9.11
Show newest version
package org.openbp.config.context;

import org.openbp.server.context.serializer.ContextObjectSerializer;
import org.openbp.server.context.serializer.ContextObjectSerializerRegistry;
import org.openbp.server.context.serializer.JavaSerializationContextObjectSerializer;
import org.openbp.server.context.serializer.PersistenceContextObjectSerializer;
import org.openbp.server.context.serializer.XStreamContextObjectSerializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Spring token context serializer configuration supporting serialization of entities, serialization using x-stream and regular Java serialization.
 */
@Configuration
public class StandardContextObjectSerializerConfig
{
	@Bean
	public ContextObjectSerializerRegistry contextObjectSerializerRegistry()
	{
		// Note that we may we must define the serializers below as beans in order to make them @autowire-capable
		ContextObjectSerializerRegistry registry = new ContextObjectSerializerRegistry();
		registry.addSerializer(persistenceContextObjectSerializer());
		registry.addSerializer(xStreamContextObjectSerializer());
		registry.addSerializer(javaSerializationContextObjectSerializer());
		return registry;
	}

	@Bean
	public ContextObjectSerializer persistenceContextObjectSerializer()
	{
		return new PersistenceContextObjectSerializer();
	}

	@Bean
	public ContextObjectSerializer xStreamContextObjectSerializer()
	{
		return new XStreamContextObjectSerializer();
	}

	@Bean
	public ContextObjectSerializer javaSerializationContextObjectSerializer()
	{
		return new JavaSerializationContextObjectSerializer();
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy