for spring bean initiation, either default constructor or auto wired

great to confirm this, spring need either default constructor, or auto wired constructor

refer to http://stackoverflow.com/questions/9296849/spring-mvc-no-default-constructor-found

default constructor is common, then for example auto wired constructor:

@Service(value = "objectToMapConverter")
public class ObjectToMapConverter {
  
	
  private static final SimpleDateFormat SDF = new SimpleDateFormat("yyyy-MM-dd");
  private static final SimpleDateFormat SYD = new SimpleDateFormat("yyyy-MM-dd");
  static {
    SDF.setTimeZone(TimeZone.getTimeZone("Europe/London"));
    SYD.setTimeZone(TimeZone.getTimeZone("Australia/Sydney"));
  }
  
  private static ClientTransactionDao txDao;
  
  @Autowired
  public ObjectToMapConverter(ClientTransactionDao clientTransactionDao) {
	// TODO Auto-generated constructor stub
	  txDao = clientTransactionDao;
  }
Advertisements

Author: lwpro2

Java J2EE professional

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s