What is it? A small, FAST and easy to use Java ORM solution for Android SQLite database. Currently being used across projects from Enterprise to Open Source. The framework is made with intention to not only be easy to setup and Read more…
Annotations are very helpful tool while programming in Java. It is a alternative to the traditional XML based configurations. Spring has picked it up early and I must admit quite beautifully.
In case you are working on something and want to use annotations for your code, here is a small guide; it will definatly make your code look clean and also will kick off the trouble of reading XMLs.
For simplicity, lets create a mock of reading column name and its value, similar to JPA.
Get the Code
Here, we would be extending / simplifying our server that we had made in our last post here.
- We had a static URL handler which was invoked when URL pattern had /static/. It made the design very specific and not generic.
- Need to make sure that in case there is no URL pattern handler for a given URL, a file for same name must be looked. If there is no such file, just raise 404 error.
Off late I have seen many people struggling with creating a static Node server, also there have been questions like “How to have static & Dynamic files served by Node”. So here I have a fully functional server that can serve both static as well as dynamic files. Off course there is no need as there are many frameworks that can take care of these things. But always good to do things on your own to learn a new language or as we say Reinventing the wheels.
Below is the server that decides what content to serve based on URL. I have used /static/ to mark static content from URL pattern. That is any URL having this pattern would be considered static and would be served from file system.
Read Complete entry
Before we kick start Node application lets start by creating a MongoDB database and credentials. Though creating database, could have been achieved by using Node, but that would not provide us with user & password. And I believe no one would want their database to be accessible to everyone. 😀
I hope you have got MongoDB installed on your machine, just start up the server and open command prompt.
>mongo MongoDB shell version: 2.0.6 connecting to: test >use supaldubey switched to db supaldubey >db.addUser('supal', 'key')
If you are looking for a “Hello World!” example, I am sorry, you have landed to a wrong page, for hello World, your best bet is the Nodejs site.
Get the first Node App!
Spring being one of the most customizable framework, provides an ability to plug in a custom view resolver.
Assume if the web application uses a particular JSP for festive time, having links or logic for some offers while other is vanila JSP page rendering response. I will demonstrate you how to achieve smooth transition in JSPs without messing up your controller return values and thus code release.
I will be using the code base from my previous example here.
Get the code!
So what is Spring MVC ?
Spring MVC is the web component of Spring’s framework apart from Spring WebFlow. Opposed to WebFlow which provides “flow” of the application MVC is more basic and robust implementation of MVC architecture. It provides a rapid development environment by easy integration with spring for enterprise applications. The flexible design of Spring enables Spring MVC to be highly configurable. Read more about Spring MVC here.
Lets get started with simple MVC project –
Java provides several ways of instantiating objects / classes. One of the most interesting features being blocks.
Java gives you an option to create two types of blocks –
- Initializer blocks
- Static blocks
Initializer blocks popularly known as Instance initializers are used to do something when an Object is created. Simple program below demonstrates a block :