提交 67d67b02 编写于 作者: 武汉红喜's avatar 武汉红喜

optimise

上级 c61469fd
...@@ -13,7 +13,7 @@ import org.springframework.stereotype.Service; ...@@ -13,7 +13,7 @@ import org.springframework.stereotype.Service;
@ConditionalOnProperty(prefix = "trade.mq", value = {"nameServer"}) @ConditionalOnProperty(prefix = "trade.mq", value = {"nameServer"})
@Slf4j @Slf4j
@Service @Service
@RocketMQMessageListener(nameServer = "${trade.mq.nameServer}", instanceName = "${trade.mq.nameServer}", topic = "test-topic-3", consumerGroup = "my-consumer_test-topic-3") @RocketMQMessageListener(nameServer = "${trade.mq.nameServer}", instanceName = "${trade.mq.clusterName}", topic = "test-topic-3", consumerGroup = "my-consumer_test-topic-3")
public class MyConsumer3 implements RocketMQListener<String> { public class MyConsumer3 implements RocketMQListener<String> {
public void onMessage(String message) { public void onMessage(String message) {
log.info("received message: " + message); log.info("received message: " + message);
......
package org.hongxi.whatsmars.spring.boot; package org.hongxi.whatsmars.spring.boot;
import org.hongxi.whatsmars.spring.boot.config.UserConfig;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ImportResource;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
...@@ -14,8 +10,6 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; ...@@ -14,8 +10,6 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableAsync @EnableAsync
@EnableScheduling @EnableScheduling
@SpringBootApplication @SpringBootApplication
@EnableConfigurationProperties({UserConfig.class})
@ImportResource(locations={"classpath*:spring/*.xml"})
public class App { public class App {
public static void main(String[] args) { public static void main(String[] args) {
......
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd"
default-autowire="byName">
<!-- 推荐注解方式,xml作为备用方式 -->
</beans>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册