On Thu, Aug 1, 2013 at 11:52 PM, Erin Noe-Payne <[email protected]> wrote: > On Thu, Aug 1, 2013 at 3:11 PM, Chris Geer <[email protected]> wrote: >> Hmmm.....why just not make it a singleton with the correct path at the >> class object? >> > > Maybe that's what I need to do. I was trying to use the sub-resource > approach because it lets you recursively resolve a route, which seems > pretty slick in general, and could be useful for pages with subpages. >
I was able to find a working example of subresources and it turns out that I should not have been instantiating a new resource each time. Now that I've switched it over to a singleton the injection is not a problem. >> >> On Thu, Aug 1, 2013 at 12:09 PM, Erin Noe-Payne >> <[email protected]>wrote: >> >>> I think I may run into an issue with this approach. My understanding >>> is that beans are singletons. If you look at the >>> DefaultRegionWidgetResource it is actually constructed as a >>> subresource each time a request is mapped to the /regionWidgets path. >>> See DefaultRegionsResource lines 88-93: >>> >>> @Override >>> public RegionWidgetsResource getRegionWidgetsResource(String regionId) >>> { >>> Region region = getPageRegion(regionId); >>> >>> return new DefaultRegionWidgetsResource(page, region); >>> } >>> >>> >>> On Thu, Aug 1, 2013 at 2:50 PM, Chris Geer <[email protected]> wrote: >>> > On Thu, Aug 1, 2013 at 11:48 AM, Erin Noe-Payne < >>> [email protected]>wrote: >>> > >>> >> On Thu, Aug 1, 2013 at 2:46 PM, Chris Geer <[email protected]> >>> wrote: >>> >> > On Thu, Aug 1, 2013 at 10:57 AM, Erin Noe-Payne < >>> >> [email protected]>wrote: >>> >> > >>> >> >> Hey all, quick question about how to configure service injection - >>> >> >> >>> >> >> If you update trunk and take a look at DefaultRegionWidgetsResource, >>> >> >> you will see that the class has a static pageService property. The >>> >> >> issue I am having is that the pageService is not being injected, so >>> it >>> >> >> is always null. >>> >> >> >>> >> >> Can anyone advise or point me at a resource to read up on how this >>> >> >> injection works? >>> >> >> >>> >> > >>> >> > I can't help you with the injection, but you can keep it simple and >>> just >>> >> > pass in the services in the XML. Nice, clean and no magic. >>> >> > >>> >> >>> >> As long as it gets there. I'll check it out, thanks. >>> >> >>> > >>> > for example from the cxf xml >>> > >>> > <bean id="categoriesBean" >>> > class="org.apache.rave.rest.impl.DefaultCategoriesResource"> >>> > <property name="categoryService" ref="defaultCategoryService"/> >>> > <property name="userService" ref="userService"/> >>> > </bean> >>> > >>> >> >>> >> >> >>> >> >> Thanks, >>> >> >> Erin >>> >> >> >>> >> >>>
