The API is bit confusing: registerSingleton() on StaticWebApplicationContext
takes a class, but registerSingleton() on ConfigurableListableBeanFactory
takes a bean. That is why I first call getBeanFactory() in my example.

ctx.getBeanFactory().registerSingleton(...)

I use StaticWebApplicationContext for my unit testing, so I am pretty sure
it works. :)

Here is the registerSingleton signature:

http://static.springsource.org/spring/docs/3.0.x/api/org/springframework/beans/factory/config/SingletonBeanRegistry.html#registerSingleton%28java.lang.String,%20java.lang.Object%29




Jochen Mader-2 wrote:
> 
> Sorry for my late answer.
> StaticWebApplicationContext doesn't cut it for  me.
> Your example contains a small mistake:
> Inserting the mock-object won't work as registerSingleton expects to get a
> Class.
> As I want to create mock objects with EasyMock there are two approaches
> (as
> far as I know).
> The one I have shown before, involving the creation of the custom
> ApplicationContextMock or using easy mock inside a testing-spring.xml.
> 
> CU
> 
> Jochen
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Wicket%2C-Spring-3-and-UnitTesting-tp27320784p27358526.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to