|
View:
New views
12 Messages
—
Rating Filter:
Alert me
|
|
|
Any issues using @SpringBean in WebApplicationHi All,
Are there any issues associated with using the @SpringBean annotation in a class that inherits from WebApplication or AuthenticatedWebApplication? Thanks, Steve |
|
|
Re: Any issues using @SpringBean in WebApplicationno
-igor On Wed, Oct 28, 2009 at 1:22 PM, Steve Hiller <shetc@...> wrote: > Hi All, > > Are there any issues associated with using the @SpringBean annotation in a class that > inherits from WebApplication or AuthenticatedWebApplication? > > Thanks, > Steve > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Any issues using @SpringBean in WebApplicationThanks Igor!
|
|
|
Re: Any issues using @SpringBean in WebApplicationHmm,
I was always thinking that the @SpringBean annotation should be used in Pages and/or components. You should inject your dependencies in your Application directly in your spring.xml. your spring.xml should contain something like this: <bean class="foo.bar.MyApplication"> <property name="googleMapsKey" value="${googlemaps.key}"/> <property name="myService" ref="service"/> </bean> your web.xml contains then a reference to your Application bean <filter> <filter-name>wicket.fast-web</filter-name> <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class> <init-param> <param-name>applicationFactoryClassName</param-name> <param-value>org.apache.wicket.spring.SpringWebApplicationFactory</param-value> </init-param> </filter> On Wed, Oct 28, 2009 at 9:22 PM, Steve Hiller <shetc@...> wrote: > Hi All, > > Are there any issues associated with using the @SpringBean annotation in a > class that > inherits from WebApplication or AuthenticatedWebApplication? > > Thanks, > Steve > -- Pieter Degraeuwe Systemworks bvba Belgiƫlaan 61 9070 Destelbergen GSM: +32 (0)485/68.60.85 Email: pieter.degraeuwe@... visit us at http://www.systemworks.be |
|
|
Re: Any issues using @SpringBean in WebApplicationah, woops. i misread "in" as "with"
you will have to inject the application class manually. after you install the spring component injector. -igor On Wed, Oct 28, 2009 at 1:29 PM, shetc <shetc@...> wrote: > > Thanks Igor! > -- > View this message in context: http://www.nabble.com/Any-issues-using-%40SpringBean-in-WebApplication-tp26101512p26101590.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@... > For additional commands, e-mail: users-help@... > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Any issues using @SpringBean in WebApplicationYou could use the @Autowired Spring annotation and the
autowire="byType" attribute to the bean definition to support autowiring to get the same effect as @SpringBean brings in Components. e.g. <bean class="foo.bar.MyApplication" autowire="byType" /> Regards, Mike > > I was always thinking that the @SpringBean annotation should be used in > Pages and/or components. > You should inject your dependencies in your Application directly in your > spring.xml. > > > your spring.xml should contain something like this: > > <bean class="foo.bar.MyApplication"> > <property name="googleMapsKey" value="${googlemaps.key}"/> > <property name="myService" ref="service"/> > </bean> > > your web.xml contains then a reference to your Application bean > > <filter> > <filter-name>wicket.fast-web</filter-name> > > <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class> > > <init-param> > <param-name>applicationFactoryClassName</param-name> > > <param-value>org.apache.wicket.spring.SpringWebApplicationFactory</param-value> > </init-param> > </filter> > > > > On Wed, Oct 28, 2009 at 9:22 PM, Steve Hiller <shetc@...> wrote: > > >> Hi All, >> >> Are there any issues associated with using the @SpringBean annotation in a >> class that >> inherits from WebApplication or AuthenticatedWebApplication? >> >> Thanks, >> Steve >> >> > > > > |
|
|
Re: Any issues using @SpringBean in WebApplicationOn Wed, Oct 28, 2009 at 5:29 PM, Michael O'Cleirigh
<michael.ocleirigh@...> wrote: > You could use the @Autowired Spring annotation and the Ā autowire="byType" > attribute to the bean definition to support autowiring to get the same > effect as @SpringBean brings in Components. Not exactly, Michael. The injected beans aren't a good candidate to pass to pages/components that need to be serialized. That's one of the main reasons why we use @SpringBean. If you're just going to use the beans by looking them up through the application object, then it's no big deal. But, if they ever make their way into a page/component as a field, then you'll have problems. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Any issues using @SpringBean in WebApplicationIs there an impact on performance if Spring beans are injected in a WebApplication and then shared for use in WebSession and WebPages (as opposed to injecting directly in WebSession and WebPages)?
|
|
|
Re: Any issues using @SpringBean in WebApplication> Is there an impact on performance if Spring beans are injected in a
> WebApplication and then shared for use in WebSession and WebPages (as > opposed to injecting directly in WebSession and WebPages)? Sharing them (just don't keep references in your components) should be slightly more efficient. Not the kind of gain you should base your decisions on imho though. Eelco --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Any issues using @SpringBean in WebApplicationHi Eelco -- My colleague and I were thinking that putting them all in the WebApplication
would make it easier to mock services for unit testing with WicketTester.
|
|
|
Re: Any issues using @SpringBean in WebApplication> Hi Eelco -- My colleague and I were thinking that putting them all in the
> WebApplication > would make it easier to mock services for unit testing with WicketTester. Alternatively, you could use e.g. InjectorHolder.setInjector(new MockSpringInjector()); like is documented in org.apache.wicket.injection.web.InjectorHolder (at least it is in Wicket 1.3 which I am using). That's a bit more flexible and you don't have to worry about cases where someone (colleague?) uses @SpringBean directly and thus compromises your test strategy). Eelco --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Any issues using @SpringBean in WebApplicationOk, I get it! I'll give a try and let you know how I get on. Thanks!
|
| Free embeddable forum powered by Nabble | Forum Help |