Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between <beans:beans> and <beans>

Tags:

spring

xml

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?

like image 942
AbdulAziz Avatar asked Sep 06 '26 04:09

AbdulAziz


1 Answers

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.

like image 156
skaffman Avatar answered Sep 07 '26 21:09

skaffman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!