diff options
author | Christof Rabensteiner <christof.rabensteiner@iaik.tugraz.at> | 2019-04-17 15:39:53 +0200 |
---|---|---|
committer | Christof Rabensteiner <christof.rabensteiner@iaik.tugraz.at> | 2019-04-17 15:39:53 +0200 |
commit | 4215362c64064947cea880d55c4aae7894304783 (patch) | |
tree | ab5145cd7d542f46fede9f953de2f850e4ff03f4 /src/main/java/at/gv/egiz/moazs/config | |
parent | 7a003c9287be57fe90173e4dd728ad995ed7036e (diff) | |
download | moa-zs-4215362c64064947cea880d55c4aae7894304783.tar.gz moa-zs-4215362c64064947cea880d55c4aae7894304783.tar.bz2 moa-zs-4215362c64064947cea880d55c4aae7894304783.zip |
Refactor: Move Configs to config Package
Diffstat (limited to 'src/main/java/at/gv/egiz/moazs/config')
3 files changed, 107 insertions, 0 deletions
diff --git a/src/main/java/at/gv/egiz/moazs/config/App2MzsServiceConfig.java b/src/main/java/at/gv/egiz/moazs/config/App2MzsServiceConfig.java new file mode 100644 index 0000000..71f5f04 --- /dev/null +++ b/src/main/java/at/gv/egiz/moazs/config/App2MzsServiceConfig.java @@ -0,0 +1,34 @@ +package at.gv.egiz.moazs.config; + +import at.gv.e_government.reference.namespace.zustellung.mzs.app2mzs_.ObjectFactory; +import at.gv.egiz.moazs.App2MzsService; +import org.apache.cxf.Bus; +import org.apache.cxf.jaxws.EndpointImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import javax.xml.ws.Endpoint; + +@Configuration +public class App2MzsServiceConfig { + + @Autowired + private Bus bus; + + @Autowired + private App2MzsService app2mzsService; + + @Bean + public Endpoint endpoint() { + EndpointImpl endpoint = new EndpointImpl(bus, app2mzsService); + endpoint.setAddress("/"); + endpoint.publish(); + return endpoint; + } + + @Bean + public ObjectFactory objectFactory() { + return new ObjectFactory(); + } +} diff --git a/src/main/java/at/gv/egiz/moazs/config/MarshallerConfig.java b/src/main/java/at/gv/egiz/moazs/config/MarshallerConfig.java new file mode 100644 index 0000000..f00a2b5 --- /dev/null +++ b/src/main/java/at/gv/egiz/moazs/config/MarshallerConfig.java @@ -0,0 +1,30 @@ +package at.gv.egiz.moazs.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.oxm.jaxb.Jaxb2Marshaller; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import java.util.HashMap; + +@Configuration +public class MarshallerConfig { + + @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); + + marshaller.setMarshallerProperties(new HashMap<String, Object>() {{ + put(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, true); + }}); + + return marshaller; + } + +} diff --git a/src/main/java/at/gv/egiz/moazs/config/RedisConfig.java b/src/main/java/at/gv/egiz/moazs/config/RedisConfig.java new file mode 100644 index 0000000..84e85d7 --- /dev/null +++ b/src/main/java/at/gv/egiz/moazs/config/RedisConfig.java @@ -0,0 +1,43 @@ +package at.gv.egiz.moazs.config; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +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.StringRedisSerializer; + +@Configuration +public class RedisConfig { + + public 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<String, Object> redisTemplate() { + final RedisTemplate<String, Object> template = new RedisTemplate<String, Object>(); + template.setConnectionFactory(jedisConnectionFactory()); + template.setDefaultSerializer(stringRedisSerializer()); + return template; + } +} |