Commit 7e579c9a by Dave Syer

Use method accessor not field

parent 8ac43cca
...@@ -115,7 +115,7 @@ public class HystrixStreamAutoConfiguration { ...@@ -115,7 +115,7 @@ public class HystrixStreamAutoConfiguration {
* @Override public void configure(HeaderEnricherSpec spec) { * @Override public void configure(HeaderEnricherSpec spec) {
* spec.header("content-type", "application/json", true); } }) * spec.header("content-type", "application/json", true); } })
*/ */
.handle(Amqp.outboundAdapter(this.amqpTemplate).exchangeName( .handle(Amqp.outboundAdapter(amqpTemplate()).exchangeName(
HystrixConstants.HYSTRIX_STREAM_NAME)).get(); HystrixConstants.HYSTRIX_STREAM_NAME)).get();
} }
......
...@@ -25,7 +25,6 @@ import org.springframework.amqp.core.BindingBuilder; ...@@ -25,7 +25,6 @@ import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange; import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue; import org.springframework.amqp.core.Queue;
import org.springframework.amqp.rabbit.connection.ConnectionFactory; import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
...@@ -70,18 +69,6 @@ public class TurbineAmqpAutoConfiguration { ...@@ -70,18 +69,6 @@ public class TurbineAmqpAutoConfiguration {
@Autowired(required = false) @Autowired(required = false)
private ObjectMapper objectMapper; private ObjectMapper objectMapper;
private RabbitTemplate amqpTemplate;
public RabbitTemplate amqpTemplate() {
if (this.amqpTemplate == null) {
RabbitTemplate amqpTemplate = new RabbitTemplate(connectionFactory());
Jackson2JsonMessageConverter converter = messageConverter();
amqpTemplate.setMessageConverter(converter);
this.amqpTemplate = amqpTemplate;
}
return this.amqpTemplate;
}
@Bean @Bean
public DirectExchange hystrixStreamExchange() { public DirectExchange hystrixStreamExchange() {
DirectExchange exchange = new DirectExchange(HystrixConstants.HYSTRIX_STREAM_NAME); DirectExchange exchange = new DirectExchange(HystrixConstants.HYSTRIX_STREAM_NAME);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment