How to read properties file in Spring.

13 Comments



If you need to read properties file in your Spring application all you need is to configure a PropertyPlaceholderConfigurer bean in your application context.
Following example shows how to read property values from a properties file named config.properties. This file needs to be in your classpath so Spring can find it.

Let’s begin by creating a simple Java class that will use the properties values from the file.

package com.zparacha.spring.examples.config;

public class CreateUser {
	//Spring will populate these fields through Dependency Injection.
        private String name;
	private String email;
	private String URL;

	public CreateUser(){}
	public String getName() {
	  return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getURL() {
		return URL;
	}

	public void setURL(String url) {
		URL = url;
	}
	public void displayUser() {
		System.out.println("Name=" + this.name);
		System.out.println("Email="+ this.email);
		System.out.println("URL=" + this.URL);
	}
}

More

article clipper vert How to read properties file in Spring.
 

How to display RSS feed on your website.

2 Comments

rss m How to display RSS feed on your website.
Image credit:Kyle Wegner

OK, admit this. You have a nice-looking website. The color and the graphics look pleasing
to visiting eyes. But you do not get a lot of loyal visitors. The problem may not be your design,
it may be the static content that is turning the visitors off. If you do not update your website regularly, you may not attract enough repeat visitors. One way to juice up your website is to display RSS feeds from other relevant and reputable websites. Don’t know how to incorporate the RSS feeds into your website? Here is what you need: More

article clipper vert How to display RSS feed on your website.
 

Learn how to make money online from experts.

3 Comments

Your blog or personal website can be a source of revenue. Some people are more successful than others in generating revenue off their websites. The reason is they know how to market their websites and attract more visitors and advertisers to their websites.

Sure you can search the Internet and find zillions of tutorials and articles on SEO and internet marketing. But that much information will overwhelm most of us. This is where Online Profits comes into picture.

This is a comprehensive Internet Marketing and Online business training program will teach you how to create or improve your online business.

The program is developed by experts in Internet Marketing and Search engine optimization techniques. Daniel Scocco of Daily Blog Tips fame is managing
the program. Some other well know contributors are

  • Michael Gray
  • Neil Patel
  • Yaro Starak
  • Tamar Weinberg
  • Hamlet Batista
  • Zac Johnson
  • Courtney Tuttle
  • Nathan Rice
  • Skellie Wag

More

article clipper vert Learn how to make money online from experts.
 

Jump start your next web design project with free web templates

No Comments

Starting a web site development project using an existing template is much more efficient than starting the project from scratch. You may use your existing web sites as the starting point and make changes to meet your new project’s requirements or get the templates from one of the following web sites that provide thousands of web site templates for free.

  • Open Design Community offers XHTML and CSS based free web design templates.

    Open Designs is a community managed site, where users, members, designers and application developers can share their free website designs and templates, discuss web design and promote their services.

  • Open Source Web Design founded by Francis J. Skettino, owsd.org offers more than 2000 templates for free.

    From personal blogs to content managements systems to full fledged businesses, OSWD has been providing free web designs to those who need them for years.

  • More

article clipper vert Jump start your next web design project with free web  templates
 

Encode / Decode HTML Entities

No Comments

html Encode / Decode HTML Entities
Image credit:lloydi

Have you been typing HTML entities by hand to include special characters in your blog post. For example to include < sign you will have to write "&lt;" in your post. It is fine if you have only few special characters in a post. But it quickly becomes cumbersome if your post is about CSS, HTML or anyother programming language and you need to write lot of special characters. Rather than typing HTML entities manually you can try one of these following websites that convert your plain text in HTML format or vice versa.

More

article clipper vert Encode / Decode HTML Entities
 

Colors by name with hex and RGB codes.

2 Comments

colors Colors by name with hex and RGB codes.
Today I stumbled upon a rather useful website. CSS Color Chart contains a neutral colors code chart and a general-purpose color code chart. You can easily toggle between Hex and RGB codes for the colors. In addition to the color code this site has the English name of every color. I’ve bookmarked the website and if you Google regularly for color chart it may be a good idea to add this site to your favorites.

Enjoy.


article clipper vert Colors by name with hex and RGB codes.
 

How to configure multiple handlers in a Spring MVC web application

4 Comments


In Spring MVC, DispatcherServlet relies on handler mapping to determine which controller the request should be sent to. All handler mapping classes in Spring implement org.springframework.web.servlet.HandlerMapping interface. Spring distribution contains following four implementation of HandlerMapping interface.

  • BeanNameUrlHandlerMapping
  • SimpleUrlHandlerMapping
  • ControllerClassNameHandlerMappign
  • CommonsPathMapHandlerMapping

BeanNameUrlHandlerMapping is the simplest of all and DispatcherServlet looks for this mapping by default.

You can use any one of these handler mappings in your application by just configuring a bean in your application context file. For e.g; to use BeanNameUrlHandlerMapping you will have a bean declaration similar to



But can you use more than one handler mappings in an application? More

article clipper vert How to configure multiple handlers in a Spring MVC web application
 

DropBox rings in new year with sleek new web interface.

No Comments

dropbox DropBox rings in new year with sleek new web interface.One of the most popular file-sharing applications DropBox has a new and improved web interface. It now offers a new and improved navigation. They have also transformed their FAQ section into a comprehensive help center. I think the most important feature is the ability to drag and drop files and folders on the web interface.

Some of the improvements are More

article clipper vert DropBox rings in new year with sleek new web interface.
 

Achieve more by typing less, use PhraseExpress.

No Comments

If you do a lot of repetitive typing, you may want to consider using PhraseExpress. This recently updated text-replacement application can save you a lot of key strokes.

PhraseExpress saves you countless keystrokes and expands custom abbreviations into frequently used text snippets. Typing ‘btw’ expands into ‘by the way’ or typing ‘excel’ can open your spreadsheet program in a snap.

Basically, you define small text snippets with full text once in the the application and then PhraseExpress expands them to full text every time you type the text snippet.

Some of the features include: More

article clipper vert Achieve more by typing less, use PhraseExpress.
 

How to remove Ctrl-M (^M) from Unix files?

1 Comment

no caret m How to remove Ctrl M (^M) from Unix files?Sometimes when you upload or FTP files from a Windows system to a UNIX box you will see ^M at the end of each line. ^M is the UNIX equivalent of DOS line break. Not only does it not look pretty, this extra character may break all sorts of scripts that you try to run on your file. So how do you remove ^M? Here are two ways to get rid or ^M (Ctrl-M) from your files. More

article clipper vert How to remove Ctrl M (^M) from Unix files?
 

Older Entries Newer Entries