Skip to content

Instantly share code, notes, and snippets.

@arey
Created August 26, 2013 13:55
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arey/6341662 to your computer and use it in GitHub Desktop.
Save arey/6341662 to your computer and use it in GitHub Desktop.
Injecting Mockito mocks into a Spring bean Avoid NoSuchBeanDefinitionException
<bean id="myService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="target">
<bean class="org.mockito.Mockito" factory-method="mock">
<constructor-arg
value="com.javaetmoi.IService" />
</bean>
</property>
<property name="proxyInterfaces">
<value>com.javaetmoi.IService</value>
</property>
</bean>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment