package at.gv.egiz.moazs; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; import org.springframework.data.redis.connection.RedisStandaloneConfiguration; import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.serializer.GenericToStringSerializer; import org.springframework.data.redis.serializer.StringRedisSerializer; import org.springframework.oxm.jaxb.Jaxb2Marshaller; import java.util.HashMap; @Configuration @PropertySource("classpath:application.properties") public class RedisConfig { @Value("${spring.redis.host}") private String host; @Value("${spring.redis.port}") private int port; @Bean JedisConnectionFactory jedisConnectionFactory() { RedisStandaloneConfiguration config = new RedisStandaloneConfiguration(); config.setHostName(host); config.setPort(port); return new JedisConnectionFactory(config); } @Bean public StringRedisSerializer stringRedisSerializer() { return new StringRedisSerializer(); } @Bean public RedisTemplate redisTemplate() { final RedisTemplate template = new RedisTemplate(); template.setConnectionFactory(jedisConnectionFactory()); template.setDefaultSerializer(stringRedisSerializer()); return template; } @Bean public Jaxb2Marshaller jaxb2Marshaller() { Jaxb2Marshaller marshaller = new Jaxb2Marshaller(); marshaller.setClassesToBeBound( at.gv.e_government.reference.namespace.zustellung.mzs.persondata_.ObjectFactory.class, at.gv.e_government.reference.namespace.zustellung.mzs.app2mzs_.ObjectFactory.class, at.gv.e_government.reference.namespace.zustellung.msg.phase2._20181206_.ObjectFactory.class, at.gv.e_government.reference.namespace.persondata.phase2._20181206_.ObjectFactory.class); //"alternatively" setContextPath(), marshaller.setMarshallerProperties(new HashMap() {{ put(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, true); }}); return marshaller; } }