我遇到一些Spring bean定义的问题.我有几个由我的main()方法加载的上下文xml文件,它们都包含几乎只有一个标记.当我的main方法启动时,我从Spring得到这个错误:
Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'converterDAO' for bean class [my.package.InMemoryConverterDaoImpl] conflicts with existing, non-compatible bean definition of same name and class [my.other.package.StaticConverterDAOImpl]
Run Code Online (Sandbox Code Playgroud)
这两个DAO类都以这种方式注释:
@Repository("converterDAO")
public class StaticConverterDAOImpl implements ConverterDAO {
...
}
Run Code Online (Sandbox Code Playgroud)
内存中的dao也有@Repository("converterDAO")注释.dao在其他类中被引用,如下所示:
...
private @Autowired @Qualifier("converterDAO") ConverterDAO converterDAO;
...
Run Code Online (Sandbox Code Playgroud)
我想要一个DAO覆盖另一个DAO的定义,正如我一直认为这是首先使用DI框架的主要原因之一.多年来我一直用xml定义做这件事,从来没有遇到任何问题.但是组件扫描和带注释的bean定义却不是这样吗?当Spring说它们不兼容时,它意味着什么呢?它们实现相同的接口,并且它们被自动装配到该接口类型的字段中.为什么他们不兼容?
有人可以为我提供一种方法,让一个带注释的,组件扫描的bean覆盖另一个吗?
-麦克风
对不起,如果这是一个奇怪的问题.但是我已经使用Indigo很长一段时间了,升级到Juno之后我发现用户界面响应性较差,有奇怪的新颜色(幸好它们包含了经典主题),而不是我能看到的一个新功能,无论如何.他们将默认的重做快捷方式从ctrl-y更改为ctrl-shift-z,即使ctrl-y是该类快捷方式的事实标准.为了改变,似乎有很多变化.
坦率地说,这个版本让我感到有些不知所措.我不是故意在这里试图消极,我想我还没有看到光线:-)
有没有人有成功的故事,Juno只是解决Indigo某些特定问题或缺点所需要的东西?
我正在为我们的某个应用程序开发消息传递接口.该应用程序是一种服务,旨在接受"作业",进行一些处理,并返回结果(实际上以文件的形式).
我们的想法是使用RabbitMQ作为消息传递基础架构,使用Spring AMQP来处理协议特定的细节.
我不希望从我的代码到Spring AMQP紧密耦合,所以我想使用Spring Integration来隐藏消息api.基本上我想要这个:
消息发送到RabbitMQ ====> Spring AMQP ====> Spring Integration ====> MyService ====>回复一直回到RabbitMQ
我正在尝试计算将这些连接在一起所需的XML配置,但我遇到了多层抽象和不同术语的问题.找到一个在Spring AMQP/RabbitMQ之上演示Spring Integration的工作示例已经证明是非常困难的,尽管这种设置对我来说是非常"最佳实践".
1)那么......有些聪明的灵魂可以快速看一下这个并且可能会让我朝着正确的方向前进吗?我需要什么,不需要什么?:-)
2)理想情况下,队列应该是多线程的,这意味着taskExecutor应该将多条消息传递给我的jobService以进行并行处理.需要什么配置?
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:rabbit="http://www.springframework.org/schema/rabbit"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-amqp="http://www.springframework.org/schema/integration/amqp"
xmlns:int-stream="http://www.springframework.org/schema/integration/stream"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
http://www.springframework.org/schema/rabbit http://www.springframework.org/schema/rabbit/spring-rabbit.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/amqp http://www.springframework.org/schema/integration/amqp/spring-integration-amqp.xsd
http://www.springframework.org/schema/integration/stream http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd
">
<context:component-scan base-package="com.myprogram.etc" />
<!-- Messaging infrastructure: RabbitMQ -->
<bean id="connectionFactory" class="org.springframework.amqp.rabbit.connection.CachingConnectionFactory">
<constructor-arg value="${ei.messaging.amqp.servername}" />
<property name="username" value="${ei.messaging.amqp.username}" />
<property name="password" value="${ei.messaging.amqp.password}" />
</bean>
<rabbit:connection-factory id="connectionFactory" />
<rabbit:admin connection-factory="connectionFactory"/>
<!-- From RabbitMQ …Run Code Online (Sandbox Code Playgroud) 考虑这个(教科书)样本飞镖码:
// Sequential processing using async and await.
main() async {
await expensiveA();
await expensiveB();
doSomethingWith(await expensiveC());
}
Run Code Online (Sandbox Code Playgroud)
我知道await将等待未来"昂贵的A"的结果在继续之前完成.
但我不明白为什么main()本身必须声明为异步?显然你必须这样做,否则程序将无法编译.但为什么同步方法不能等待异步调用的结果呢?
我知道这一定是一个新手问题,但我还没有找到答案.
在最近升级到Eclipse Eclipse之后,我遇到了一个问题,eclipse不再能够记住重启和工作区交换机之间的某些设置.类似于哪些视角是开放的,某些设置如"[x] Open Dashboard"(spring ide)似乎在重新启动eclipse时恢复到出厂设置.
我使用Ubuntu,由于历史原因,我在/ opt/eclipse中维护我的eclipse安装.安装由root拥有,除了一些升级问题之外,这实际上并不是一个问题 - 直到Juno发布.
我已经尝试了chown -R我自己:在eclipse安装目录中,我已经验证了我自己的用户确实可以编辑所有文件.不过,这些观点似乎已经重置.
有没有其他地方eclipse存储这些信息,哪些可能仍然由root拥有?
eclipse-juno ×2
amqp ×1
asynchronous ×1
dart ×1
eclipse ×1
install ×1
rabbitmq ×1
repository ×1
spring ×1
ubuntu ×1
upgrade ×1