Issue 1:
Glen Mazza opened SPR-2177 and commented

The 2.0 Spring form:errors tag will expand an error message, if a validation error is found in the command bean property, as follows:

<form:errors path="password"/> becomes:

<span id="password.errors" name="password.errors">Password is missing</span>

An "id" and a "name" attribute is added to the span, both with the same value of "{commandbeanname}.errors".

Two suggestions:

1.) One problem with having an "id" attribute automatically added to the span is that id's are supposed to be unique in an HTML document[1]. Although a rare use case, one could duplicate the form:errors tag for the same command bean property, with the result that the output HTML will have a duplicated ID. Also, I'm unsure what additional benefits "id" buys the user that the already present "name" does not, so removing "id" might make sense.

2.) It might be beneficial to add a class attribute with the same value to all spans (regardless of property), perhaps called "formErrors". This will allow one to conveniently use a CSS selector to specify that class value in order to apply common formatting (such as red fonts) to all error messages:

*.formErrors {
color: red
}

Glen

[1] http://www.w3.org/TR/REC-CSS2/selector.html#id-selectors

Affects: 2.0 RC1

Issue 2:
Cameron Clarke opened SPR-1216* and commented

Specific scenario, running JUnit test cases extending {@link org.springframework.test.AbstractTransactionalSpringContextTests} where the application utilises org.hibernate.jmx.StatisticsService as defined in spring-data-access-context.xml (see below), test fail due to :

<testcase classname="TestActionTypeDaoImpl" name="testGetAll" time="17.375">

<error message="Error creating bean with name 'jmxExporter' defined in class path resource [spring-data-access-context.xml]: Initialization of bean failed; nested exception is javax.management.InstanceAlreadyExistsException: Hibernate:name=hbmStats" type="org.springframework.beans.factory.BeanCreationException">org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmxExporter' defined in class path resource [spring-data-access-context.xml]: Initialization of bean failed; nested exception is javax.management.InstanceAlreadyExistsException: Hibernate:name=hbmStats

javax.management.InstanceAlreadyExistsException: Hibernate:name=hbmStats

at com.sun.jmx.mbeanserver.RepositorySupport.addMBean(RepositorySupport.java:452)

at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.internal_addObject(DefaultMBeanServerInterceptor.java:1410)

at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:936)

at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:337)

at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:497)

at org.springframework.jmx.export.MBeanExporter.registerMBean(MBeanExporter.java:413)

at org.springframework.jmx.export.MBeanExporter.registerBeanInstance(MBeanExporter.java:389)

at org.springframework.jmx.export.MBeanExporter.registerBeanNameOrInstance(MBeanExporter.java:369)

at org.springframework.jmx.export.MBeanExporter.registerBeans(MBeanExporter.java:296)

at org.springframework.jmx.export.MBeanExporter.afterPropertiesSet(MBeanExporter.java:240)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1003)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:348)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)

at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:275)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:317)

at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:80)

at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:65)

at org.springframework.test.AbstractSpringContextTests.loadContextLocations(AbstractSpringContextTests.java:121)

at org.springframework.test.AbstractDependencyInjectionSpringContextTests.loadContextLocations(AbstractDependencyInjectionSpringContextTests.java:159)

at org.springframework.test.AbstractSpringContextTests.getContext(AbstractSpringContextTests.java:101)

at org.springframework.test.AbstractDependencyInjectionSpringContextTests.setUp(AbstractDependencyInjectionSpringContextTests.java:127)

</error>

spring-data-access-context.xml defined as ....

...

<bean id="jmxExporter"

class="org.springframework.jmx.export.MBeanExporter"

depends-on="jmxServer">

<property name="beans">

<map>

<entry key="Hibernate:name=hbmStats">

<ref bean="hibernateStatisticsJMXBean"/>

</entry>

</map>

</property>

</bean>

<bean id="hibernateStatisticsJMXBean" class="org.hibernate.jmx.StatisticsService">
<property name="statisticsEnabled">
<value>true</value>
</property>
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>

<bean id="jmxServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
<property name="defaultDomain">
<value>dummyDomain</value>
</property>
</bean>

...

My current work around class....

/** The SpringFrameworks (v.1.2.3) {@link org.springframework.jmx.export.MBeanExporter} does not detect

MBeans already registered and may attempt to register duplicate MBeans. Either a unique / dynamic

object naming convention could be employed to avoid this or alternatively, simply ignore

{@link javax.management.InstanceAlreadyExistsException} exceptions which is the policy

employed by this class.

@author Cameron Clarke

@version $Id: $

*/

import org.springframework.beans.factory.BeanFactoryAware;

import org.springframework.beans.factory.DisposableBean;

import org.springframework.beans.factory.InitializingBean;

import org.springframework.jmx.export.MBeanExporter;

import javax.management.JMException;

import javax.management.InstanceAlreadyExistsException;

public class SpringMBeanExporter extends MBeanExporter implements BeanFactoryAware, InitializingBean, DisposableBean

{

protected void registerBeans() throws JMException

{

try

{

super.registerBeans();

} catch (InstanceAlreadyExistsException ex)

{

logger.error("Instance already exists, registering JMX bean failed.", ex);

}

}

}

Affects: 1.2.3

Issue Links:

#5921 JMX InstanceAlreadyExistsException when deploying same app twice ("is duplicated by")