Closed hvgotcodes closed 7 years ago
I'd like to be able to use a standard Spring controller with Katharsis so that I can write tests with the mock mvc builders. I think I could do that using this same information...
This is an interesting question, and I'm not sure it is possible. The spring integration katharsis offers is definitely centered around Spring Boot, and more recently spring-data. Katharsis can be used in a spring boot or vanilla spring project, but it is not meant to be integrated with spring mvc. Katharsis provides its own concept of controllers (repositories) and is intended to be used instead of spring mvc, not along with.
Maybe @remmeier or @chb0github could comment more.
Edit: @chb0github recently made a comment about this over in #166:
Katharsis is not a Spring MVC application -- it's using spring for DI but it's actually coming through a classic filter chain and totally sidestepping Spring -- So, katharsis is basically commandeering that space in the application before spring can get involved and thus spring never even receives the dispatch request.
I guess a JAX-RS setup with SpringServiceDiscovery in the classpath would be very easy to setup in a plain Spring app.
not sure about how deeply the current integration integrates with spring boot. Three is no connection to spring data as far as I know. And the spring boot-specific stuff looked fairly simple. Potentially we could just provide a spring xml or application config without any spring boot. But I'm not using spring, so no guarantees...
@remmeir would it be possible to use just the json-api serialization/deserialization functionality with Spring? Perhaps by extending GenericHttpMessageConverter
and registering that? What part of Katharsis is actually doing the reading/writing of json?
currently it is integrated as AbstractKatharsisServlet and KatharsisInvoker does the reading/writting.
Potentially we could just provide a spring xml or application config without any spring boot.
@remmeier Yes that's what we're doing actually. We used most of the Java configuration from katharsis spring, but then used the KatharsisInvokerBuilder filter from the jersey example. We couldn't use the spring filter as it uses SpringParameterProvider
which seems heavily integrated with some spring mvc or boot stuff we don't use.
At some point I'd like to refactor the spring library to support the more generic xml / app config, but this still has nothing to do with spring MVC.
Closing this unless someone else has something more to add
New user here, sorry for the basic question. I am having trouble integrating Katharsis with SpringMVC. Is it possible to use Katharsis in Spring for only JSON-Api serialization/de-serialization?
If so how would I tell Spring that when a @JsonApiResource is returned from a controller to serialize to JSON-API?
I am asking in the context of SpringMVC, not SpringBoot. It seems like a lot of the Spring integration provided is in the context of SpringBoot.