Am 09.03.2011 11:28, schrieb Arjun Dhar:
Hi,
  I wanted to externalize the Page Mounts using Spring.

Earlier in my "Application" class the code was like:

mount(new QueryStringUrlCodingStrategy("login", loginPage.class));


So What I did was:

...
                 //Scan for All IMountLoaders in the context and get the
Mount points from them automatically
                 Map mountLoadersMap =
springContext.getBeansOfType(IMountLoader.class);
                 List mountPoints = ... Get Mount Points from Spring ...
                for (IRequestTargetUrlCodingStrategy mountPoint : mountPoints) {
                        mount(mountPoint);
                }
...


::::::::::::::::::::: SPRING FILE CORRESPONDING CONFIG :::::::::::::::::::::


        
        
                
                
                        
                
                
        


However this leads to an Exception:
.springframework.beans.BeanInstantiationException: Could not instantiate
bean class [com.me.loginPage]: Constructor threw exception; nested exception
is java.lang.IllegalStateException: you can only locate or create sessions
in the context of a request cycle:

java.lang.IllegalStateException: you can only locate or create sessions in
the context of a request cycle
         at org.apache.wicket.Session.findOrCreate(Session.java:209)
         at org.apache.wicket.Session.get(Session.java:253)
         at
org.apache.wicket.Application$1.onInstantiation(Application.java:299)
         at
org.apache.wicket.Application.notifyComponentInstantiationListeners(Application.java:1093)



I wanna keep the code fluid and dont wanna wire it to any specific
@SpringBean kinda config. Is there an easy way out here?




-----
Don't take life too seriously, your'e not getting out it alive anyway!
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Externalizing-Page-Mounts-Via-Spring-tp3343247p3343247.html
Sent from the Users forum 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



There is a realy cool annotation project in wicket-stuff. With this you could externalize the packages to scan for pages. Mounting goes to page and scanned packages to spring-config.

Doc: http://wicketstuff.org/confluence/display/STUFFWIKI/wicketstuff-annotation

Just my 2$.
Mike

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

Reply via email to