Results 1 to 2 of 2

Thread: Issue with @Provide and @Profile working together.

  1. #1
    Join Date
    Mar 2012
    Posts
    10

    Default 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. #2
    Join Date
    Mar 2012
    Posts
    10

    Default

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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •