Spring boot data rest gotcha

I’ve been recently playing with Spring Boot and its potential for micro services.

I was particularly interested in the spring-boot-data-rest section. However I struggled to get something working . Any time I tried to make a REST request using cURL, I kept experiencing the following error:

# curl localhost:8080

{
    "timestamp" : 1404054038107,
    "status" : 500,
    "error" : "Internal Server Error",
    "exception" : "java.lang.UnsupportedClassVersionError",
    "message" : "org/atteo/evo/inflector/English : Unsupported major.minor version 51.0",
    "path" : "/"
}
2014-06-29 16:00:38.101 ERROR 7165 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler processing failed; nested exception is java.lang.UnsupportedClassVersionError: org/atteo/evo/inflector/English : Unsupported major.minor version 51.0] with root cause

java.lang.UnsupportedClassVersionError: org/atteo/evo/inflector/English : Unsupported major.minor version 51.0
 at java.lang.ClassLoader.defineClass1(Native Method)
 at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
 at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
 at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
 at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
 at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

After much googling, it turns out that there seems to be a problem with the version of the Inflector library that was being imported by spring-boot.

To fix this I simply updated the dependency used in my pom.xml thus overriding the the spring version. Like so:

<dependency>
    <groupId>org.atteo</groupId>
    <artifactId>evo-inflector</artifactId>
    <version>1.2</version>
</dependency>

MySQL Permission Replication

A little MySQL gotcha

So you’re working in a MySQL replication environment and you realise that you want to prevent your permissions replicating from your master to your slave.

MySQL replication filtering is client side so you logically decide that adding the following config to your my.cnf would stop filtering.

replicate-ignore-db = mysql

You happily perform a GRANT statement on your master database. Wait….what the…..my user has also been created on the slave!

You research and it turns out that in order to prevent MySQL permissions from replicating you have to specifically use wildcard filtering like so:

replicate-wild-ignore-table=mysql.%

Reference: http://dev.mysql.com/doc/refman/5.0/en/replication-features-userprivs.html