Posts

Showing posts from June, 2013

Maven resource filtering not working on spring configuration xml file

I recently run on a weird problem while running property filtering on tutorial project that I'm writing.One of my configuration files (spring XML config files) was being partially filtered (only the first 2 variables were properly "filtered" while the rest was left as they were )Below is my configuration file. Only the first 2 variables where filtered (mongo.host & mongo.port) : I've tried a few things and realized that if I moved them around then suddenly it would work but I couldn't put my finger on what was causing the problem So I decided to remove line by line from the bottom up and check if something will fix the problem As it turns out what was causing the problem was the '@' in my comment right before the repository configuration. This actually was a maven bug in the maven-resources-plugin but fear not the bug was corrected in the 2.6 versionSo if you come up by this behavior check your pom.xml configuration as by default my maven was using …

Spring MVC and Swagger. Generating documentation for your RESTful web services - PART 2

Image
Automating your RESTful web services documentation Using Spring MVC with Swagger for generating it
Part 2 - Implementing some business logic and configuring Swagger
1.- Configuring swagger and swagger-ui1.1.- What is swagger ? Swagger is a specification and complete framework implementation for describing, producing, consuming, and visualizing RESTful web services as stated by their official website Personally I find Swagger to be a pretty nice way to generate my web services documentation instead of having to rewrite everything again (I already comment my code so it should be enough!) However at the moment swagger does not support Spring MVC natively but there is an implementation over at github here As stated by the developer not all the Swagger annotations are currently supported but the implementation works mainly with the Spring MVC annotations(@Controller, @RequestMapping , etc.) which I just what I needed. 1.2.- Integrating swagger into spring First thing to do is to create…

Spring MVC and Swagger. Generating documentation for your RESTful web services - PART 1

Image
Automating your RESTful web services documentation Using Spring MVC with Swagger for generating it
Part 1 - Setting up the WAR and spring configuration
1.- Introduction
Through this simple tutorial I will be developing a simple web application using the following technologies : spring (mvc, core, jdbc) : Dependency Injection, Database access, RESTful web services implementation hsqldb : On memory databaseswagger : Documentation frameworkswagger-spring-mvc : Swagger integration with spring mvcmaven : build lifecyclejetty : web application serverThe main goal of this tutorial is to illustrate how the swagger documentation framework can be integrated into a spring mvc application.2.- The Database Model In this tutorial we will be using a very simple model consisting of 1 table :
3.- Creating the maven project structure There are a few of Spring archetypes when creating java web applications but I find them oversized for this simple tutorial so I will use here the org.codehaus.mojo.archety…