You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2021/11/20 16:13:01 UTC
[GitHub] [rocketmq-spring] rom1c77 opened a new issue #406: RocketMQTemplate injection faild
rom1c77 opened a new issue #406:
URL: https://github.com/apache/rocketmq-spring/issues/406
this is the error log. when i use `bootstrap.yml`. RocketMQAutoConfiguration not injection RocketMQTemplate;
if use `application.yml` replace `bootstrap.yml` will be succeed;
i don't know why not use `bootstrap.yml`?
```
2021-11-21 00:07:14.198 INFO 13196 --- [ main] org.example.SpringbootDemoApplication : Starting SpringbootDemoApplication on rom1c with PID 13196 (D:\workspace\springboot-demo\target\classes started by admin in D:\workspace\springboot-demo)
2021-11-21 00:07:14.200 INFO 13196 --- [ main] org.example.SpringbootDemoApplication : No active profile set, falling back to default profiles: default
2021-11-21 00:07:14.831 INFO 13196 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2021-11-21 00:07:14.837 INFO 13196 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-11-21 00:07:14.838 INFO 13196 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.38]
2021-11-21 00:07:14.915 INFO 13196 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-11-21 00:07:14.916 INFO 13196 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 687 ms
2021-11-21 00:07:14.950 WARN 13196 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'produderController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.apache.rocketmq.spring.core.RocketMQTemplate' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@javax.annotation.Resource(shareable=true, lookup=, name=, description=, authenticationType=CONTAINER, type=class java.lang.Object, mappedName=)}
2021-11-21 00:07:14.952 INFO 13196 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2021-11-21 00:07:14.960 INFO 13196 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-11-21 00:07:15.032 ERROR 13196 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
A component required a bean of type 'org.apache.rocketmq.spring.core.RocketMQTemplate' that could not be found.
The following candidates were found but could not be injected:
- Bean method 'rocketMQTemplate' in 'RocketMQAutoConfiguration' not loaded because @ConditionalOnBean (types: org.apache.rocketmq.client.producer.DefaultMQProducer; SearchStrategy: all) did not find any beans of type org.apache.rocketmq.client.producer.DefaultMQProducer
Action:
Consider revisiting the entries above or defining a bean of type 'org.apache.rocketmq.spring.core.RocketMQTemplate' in your configuration.
Disconnected from the target VM, address: '127.0.0.1:62492', transport: 'socket'
Process finished with exit code 1
```
`bootstrap.yml`
```
server:
port: 8081
spring:
application:
name: producer
#producer
rocketmq:
name-server: 127.0.0.1:9876
producer:
group: task-produer
send-message-timeout: 300000
compress-message-body-threshold: 4096
max-message-size: 4194304
retry-times-when-send-async-failed: 0
retry-next-server: true
retry-times-when-send-failed: 2
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org