Spring Migration Analyzer – The Beginning
Comments: 1Spring Team surprised us once again with Spring Migration Analyzer tool. Migration with Spring wasn’t so painful, BUT this one create report for us. Now it easier to estimate effort and we now spots where we should put our attention. I read InfoQ article: “Spring Migration Analyzer: An Assistant For JavaEE To Spring Conversion” about great […]
Categories
Spring Template Objects Testing
Comments: 2My friend asked me, how we should test this piece of code public void fire(final NotificationMessage message) { jmsTemplate.send(new MessageCreator() { @Override public Message createMessage(Session session) throws JMSException { return session.createObjectMessage(message); } }); } Mock, stubs, arguments matchers are not successful here. Of course we can mock jmsTemplate, verify if send method was executed, but […]
Categories
Spring Data – Redis – tutorial
Comments: 2Spring Data project provides a solution to access data stored in new emerging technologies like NoSQL databases, cloud based services etc. When we look into SpringSource git repository we see a lot of spring-data projects: spring-data-commons: common interfaces and utility class for other spring-data projects. spring-data-column: support for column based databases. It has not started […]
Categories
Spring MVC Exception Handler
Comments: 7In previous version of Spring Framework to handle exception we used HandlerExceptionResolver interface. Spring also provides simple implementations which was suitable in most of cases. Since 3.0 version we have few additional exception resolvers plus we can use annotation to specify our exception handler methods or classes without implementing HandleExceptionResolver interface. AnnotationMethodHandlerExceptionResolver (new in 3.0) […]
Categories
How to extend SQLErrorCodesFactory
I found some interesting feature in springframework. Spring offers you to map sql error code to exception type. By default there is in springframework distribution file called sql-error-codes.xml which has definition for common databases ( DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase). This keys are taken form java.sql.DatabaseMetaData databaseProductName property. Each driver […]
Categories
java spring config
There is a possibility to configure spring framework only in java. Yep no XML ;). There is a project spring-java-config. This project aims to provide a way to configure spring without XML. To use it with maven you should add repository to your pom and dependency <repository> <id>spring-milestone</id> <name>Spring Milestone Repository</name> <url>http://s3.amazonaws.com/maven.springframework.org/milestone</url> </repository> <dependency> <groupId>org.springframework.javaconfig</groupId> […]