> Cayenne is pretty generic as far as integrations go - it should work well > and easily with any framework.
Yep. >> Has anyone done this before? Are there any suggestions on what I should >> be certain to do or avoid? Should I just spin up the standard Cayenne web >> filter? Are there other choices? It's been 3 years since I tried SpringBoot, so I don't remember all the classes involved. But at the high level the approach should be the same as with Bootique: 1. Bind ServerRuntime as an injectable *singleton* 2. Figure out how to scope ObjectContexts based on the app specifics. I'd actually avoid CayenneFilter. It is too servlet-specific and favors session scope for the context. My typical pattern for #2 is creating a simple custom service like this: public interface ICayenneService { ObjectContext sharedContext(); ObjectContext newContext(); } It provides user-friendly API around ServerRuntime, and you inject it everywhere you need a context. You'd use "sharedContext" for reads, and "newContext" for writes. Also just found this on GitHub [1]. Not sure how legit it is. But posting our own "canonical" SpringBoot example is probably a good idea. Andrus [1] https://github.com/Softmotions/spring-boot-starter-cayenne > On Aug 13, 2019, at 7:56 PM, John Huss <johnth...@gmail.com> wrote: > > Cayenne is pretty generic as far as integrations go - it should work well > and easily with any framework. Just create your ServerRuntime and define a > way to retrieve it (using ServletContext.setAttribute is typical). Then > you'll want to bind the runtime to each request that comes in, which is all > that CayenneFilter does. If CayenneFilter has worked for you, then just use > that. CayenneFilter is very minimal so you copy it and customize it if > needed. > > On Tue, Aug 13, 2019 at 11:29 AM Tony Giaccone <t...@giaccone.org> wrote: > >> I want to look into using Cayenne with SpringBoot. I was able to get a >> basic cayenne stack up and running by implementing a ContextListener and >> on the create event starting up a Cayenne Runtime. I was using an in >> memory database and I had problems getting the ;create=true working. My >> hack was to set the strategy on the DataNode after the runtime after it >> was spun up. >> >> Has anyone done this before? Are there any suggestions on what I should >> be certain to do or avoid? Should I just spin up the standard Cayenne web >> filter? Are there other choices? >> >> Thanks for any help you can provide. >> >> >> Tony >>