Announcement Announcement Module
Collapse
No announcement yet.
Issue with @Provide and @Profile working together. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Issue with @Provide and @Profile working together.

    Hi,
    We have a spring-jersey app. We use spring bean profiles for configuring various environments in our application. Its works great untill we tried adding a provider. We are using JacksonJsonProvider in our applicaton for modfying json output. But we want to use this provider in only one of our environments. So we tried plugging in the provider as per environment using spring bean profiles. we have something like this.

    Code:
    @Provider
    @Profile("docs")
    @Produces(MediaType.APPLICATION_JSON)
    public class JacksonJsonProvider extends JacksonJaxbJsonProvider {
    We just want to apply this provider when the profile is 'docs' . But this does not seem to work. The provider is being applied to all environments irrespective. Seems like @Provide and @Profile tags dont go well together.

    Please let us know if there is any mistake in this or if there is a better way forward.

    Thanking you.

    regards,
    Navin.

  • #2
    Bw, just realised that @Provider is a Jersey annotation and not a spring one. Is there any the two can work together?

    Comment

    Working...
    X