From 4215362c64064947cea880d55c4aae7894304783 Mon Sep 17 00:00:00 2001 From: Christof Rabensteiner Date: Wed, 17 Apr 2019 15:39:53 +0200 Subject: Refactor: Move Configs to config Package --- .../at/gv/egiz/moazs/App2MzsServiceConfig.java | 33 ----------------- .../java/at/gv/egiz/moazs/MarshallerConfig.java | 30 --------------- src/main/java/at/gv/egiz/moazs/RedisConfig.java | 43 ---------------------- .../gv/egiz/moazs/config/App2MzsServiceConfig.java | 34 +++++++++++++++++ .../at/gv/egiz/moazs/config/MarshallerConfig.java | 30 +++++++++++++++ .../java/at/gv/egiz/moazs/config/RedisConfig.java | 43 ++++++++++++++++++++++ 6 files changed, 107 insertions(+), 106 deletions(-) delete mode 100644 src/main/java/at/gv/egiz/moazs/App2MzsServiceConfig.java delete mode 100644 src/main/java/at/gv/egiz/moazs/MarshallerConfig.java delete mode 100644 src/main/java/at/gv/egiz/moazs/RedisConfig.java create mode 100644 src/main/java/at/gv/egiz/moazs/config/App2MzsServiceConfig.java create mode 100644 src/main/java/at/gv/egiz/moazs/config/MarshallerConfig.java create mode 100644 src/main/java/at/gv/egiz/moazs/config/RedisConfig.java (limited to 'src/main') diff --git a/src/main/java/at/gv/egiz/moazs/App2MzsServiceConfig.java b/src/main/java/at/gv/egiz/moazs/App2MzsServiceConfig.java deleted file mode 100644 index 578fecd..0000000 --- a/src/main/java/at/gv/egiz/moazs/App2MzsServiceConfig.java +++ /dev/null @@ -1,33 +0,0 @@ -package at.gv.egiz.moazs; - -import at.gv.e_government.reference.namespace.zustellung.mzs.app2mzs_.ObjectFactory; -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/MarshallerConfig.java b/src/main/java/at/gv/egiz/moazs/MarshallerConfig.java deleted file mode 100644 index 9106dd0..0000000 --- a/src/main/java/at/gv/egiz/moazs/MarshallerConfig.java +++ /dev/null @@ -1,30 +0,0 @@ -package at.gv.egiz.moazs; - -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() {{ - put(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, true); - }}); - - return marshaller; - } - -} diff --git a/src/main/java/at/gv/egiz/moazs/RedisConfig.java b/src/main/java/at/gv/egiz/moazs/RedisConfig.java deleted file mode 100644 index 321ec4a..0000000 --- a/src/main/java/at/gv/egiz/moazs/RedisConfig.java +++ /dev/null @@ -1,43 +0,0 @@ -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.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 redisTemplate() { - final RedisTemplate template = new RedisTemplate(); - template.setConnectionFactory(jedisConnectionFactory()); - template.setDefaultSerializer(stringRedisSerializer()); - return template; - } -} 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() {{ + 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 redisTemplate() { + final RedisTemplate template = new RedisTemplate(); + template.setConnectionFactory(jedisConnectionFactory()); + template.setDefaultSerializer(stringRedisSerializer()); + return template; + } +} -- cgit v1.2.3