2

I am creating web service. I have application tier and web tier. Both of this tier using jaxb to generate object factory from xsd. Generating class are in package: my.package.v1

Now I have another project which has dependency on these project. In context I have specify object factory:

<bean id="objectFactory" class="my.package.v1.ObjectFactory" />

when I compile and deploy application everything is OK. But there is two Object factory and he can use just one of them. Which one application use and how I change it and use another one ?

UPDATE:

Is there options how to set in spring context which class to use ? I want change this to set right class when I have two ObjectFactory

<bean id="objectFactory" class="my.package.v1.ObjectFactory" /> 
hudi
  • 15,555
  • 47
  • 142
  • 246
  • 3
    *Why* would you generate the same names in the same package? It's just asking for trouble. Separate out the packages. – Jon Skeet Sep 07 '12 at 07:35
  • I dont know :). I am just junior programmer and this was idea of seniors – hudi Sep 07 '12 at 07:44
  • I suggest you raise it with them then. It really is a bad idea to have the same fully-qualified name mean two different things. – Jon Skeet Sep 07 '12 at 08:26

2 Answers2

0

Which one of the two implementations of my.package.v1.ObjectFactory that is actually used depends on the ClassLoader.

See this question for info on how ClassLoaders resolve this kind of issue.

Community
  • 1
  • 1
uldall
  • 2,458
  • 1
  • 17
  • 31
0

There can be conflicting results and depends on Contextual classloader. I would suggest to have them in separate packages to avoid namespace conflicts

Chris
  • 5,584
  • 9
  • 40
  • 58