我正在尝试使用由SpringBootApplication调用的@ Bean注释创建MQConnectionFactory。下面是异常堆栈。
`启动失败'org.springframework.beans.factory.config.BeanExpressionException'表达式解析失败嵌套异常是org.springframework.expression.spel.spelevaluationexception EL1008e属性或字段'queueManagerName'在类型对象上找不到org.springframework.beans.factory.config.beanexpressioncontext
配置类如下所述* : -
@Configuration
class MQConfig{
@Value("${queue.manager}")
private String queueManagerName;
@Bean
public MQConnectionFactory defaultConnectionFactory(){
MQConnectionFactory mqConnectionFactory = new MQConnectionFactory();
mqConnectionFactory.setQueueManagerName(queueManagerName);
return mqConnectionFactory;
}
}
用法如下* : -
@Component
QueueMsgReceiver{
@JmsListener(destination="${main.job.queue}",concurrency="1")
public void updateMsg(Message jsonMsg) throws JmsException,ExecutionException,InterruptedException{
}
}
祈求者如下* : -
@EnableJMS
@SpringBootApplication(exclude={FreeMarkerAutoConfiguration.class})
public class Application{
public static void main(String args[])
{
SpringApplication.run(Application.class,args);
}
}