Skip to main content

Posts

Showing posts from May, 2011

Apache Tomcat 7.0.14 released

From the Tomcat announce list: The Apache Tomcat team announces the immediate availability of Apache Tomcat 7.0.14  Apache Tomcat 7.0.14 includes bug fixes and the following new features compared to version 7.0.12:  new StuckThreadDetectionValve to identify long running requests JAAS authentication support for the JMXRemoteLifecycleListener updated MIME type mappings to align with those of Apache httpd Please refer to the change log for the list of changes:  http://tomcat.apache.org/tomcat-7.0-doc/changelog.html  Note that this version has 4 zip binaries: a generic one and three bundled with Tomcat native binaries for Windows operating systems running on different CPU architectures.  Downloads : http://tomcat.apache.org/download-70.cgi  Migration guide from Apache Tomcat 5.5.x and 6.0.x : http://tomcat.apache.org/migration.html

Basic Java CRUD Operations with MongoDB

In this post I’d like to show how to perform basic CRUD operations against a MongoDB database using the Java driver. For this post, lets assume that we have a todo database with a collection of todo items. Each item has a task and a priority. In terms of JSON notation, an example item would look like: { "_id" : { "$oid" : "4bffb75121eec88a67ff6ec8"} , "task" : "Write Code" , "priority" : "high" } Now that we have defined what we are storing in the database, lets have a look at how we connect to Mongo. Connection to the database To connect to a MongoDB database, we would use code similar to that below. In this code you can see that we are connecting to a database called todo and getting the collection called items. In MongoDB if neither of these items exist, they will be automatically created. Mongo mongo = new Mongo(); DB db = mongo.getDB("todo"); DBCollection items = db.getColl...

Spring Framework Tooling Upgraded

SpringSource, the people behind the Spring Framework, have today released an upgrade to the SpringSource Tool Suite. Version 2.6.1 of SpringSource Tool Suite provides support for vFabric tcServer 2.5.  vFabric tcServer is described as " an enterprise version of Apache Tomcat, the widely adopted application server. Optimized for Java Spring users, with a lightweight footprint, vFabric tc Server is ideally suited for usage in modern virtual environments. " Full release notes for STS can be downloaded from here . STS can be upgraded from within the toolsuite itself if you have a previous version, or downloaded from SpringSource.com .  vFabric tcServer developer edition can be downloaded from VMWare .

Spring 3.1.M1 @Cacheable Doesn’t Evict – A Workaround

Spring 3.1 introduces a new feature to allow methods to be cached and evicted thus allowing resource heavy methods to be avoided where possible. Caching is enabled via the new @Cacheable and @CacheEvict annotations. For full details of Spring caching have a look at Costin Leau’s blog post . One example of caching would be, for example, database activity. We can apply the @Cacheable annotation to a find operation and then apply the @CacheEvict to an update / delete operation. In this sense, caching would work much like a second level cache in Hibernate or JPA. To enable caching on a find method, the method needs to be annotated with the @Cacheable annotation identifying which cache to use. Spring allows multiple caches to be defined each of which can be backed by a different caching abstraction. @Cacheable("items") public Item find(long itemId) { Item item = entityManager.find(Item.class, itemId); return item; } When it is time to invoke the find method, S...