AbdulAziz
AbdulAziz

Reputation: 6298

Difference between <beans:beans> and <beans>

I just bean through two web application and in both project's "applicationContext.xml" file there is a tag

<beans:beans>
 ... 
</beans:beans> 

and in another is

<beans> 
... 
</beans>

Can someone explain to me is there any difference?

Upvotes: 3

Views: 5614

Answers (2)

skaffman
skaffman

Reputation: 403601

There is no semantic difference, they mean exactly the same thing. It's just a difference in how their XML namespaces are declared.

You'll see that the first example declares the namespace like this, which declares a namespace prefix beans: and binds it to the namespace URI http://www.springframework.org/schema/beans:

<beans:beans xmlns:beans="http://www.springframework.org/schema/beans" ...

The second will use the "default" namespace, which binds the same URI to the default namespace (i.e. the one with no prefix):

<beans xmlns="http://www.springframework.org/schema/beans" ...

For more details, go and read up on XML Namespaces.

Upvotes: 9

Alexey Berezkin
Alexey Berezkin

Reputation: 1543

<beans:beans> refers to beans tag from beans namespace. <beans> refer to beans tag of the default namespace. If the default namespace is beans then there is no difference.

Upvotes: 3

Related Questions