In the online source code generation tool SpringFuse the suggest when using Spring not to name the persistence unit persistence.xml. Rather they rename the file to spring-persistence.xml: https://github.com/jaxio/generated-projects/blob/master/jpa2-backend/src/main/resources/META-INF/spring-persistence.xml . They say:
It is named spring-persistence.xml to prevent JBoss from picking it automatically, which would create a mess as we use Spring.
But why would this create a mess and what type of mess? We use spring and have the file named persistence.xml and it works. We use JBoss AS 6.1.