What you are doing currently is fine, although I would say it is more of an integration test than a unit test.
My main suggestion would be to only bring up parts of the system that you absolutely need for the component under test, e.g. the ProductDAO
.
You already seem to be doing this to a certain extent but what may also help is reducing the scope of your component-scan
to where you keep your DAOs, e.g.:
<context:component-scan base-package="com.myapp.dao" />
This would avoid picking up higher-level components such as Controllers and Service.
You could then rename the context to test-dao-context.xml
and use it in all your other DAO tests.
When you come to integration testing your Services you could then have a test-service-context.xml
context which imports test-dao-context.xml
allowing you to test from the service to the database without too much repetition of bean definitions.