spring beanの利用

classを作ります。

package jp.spring.sample1;

import java.util.Calendar;
import java.util.Date;

public class MyBean {
	private Date date;
	private String message;
	
	public MyBean() {
		super();
		this.date = Calendar.getInstance().getTime();
	}
	public MyBean(String message) {
		this();
		this.message = message;
	}
	
	public Date getDate() {
		return date;
	}
	
	public void setMessage(String message) {
		this.message = message;
	}
	
	@Override
	public String toString() {
		return "MyBean [message=" + message + ", date=" + date + "]";
	}

}

App.java

package jp.spring.sample1;

public class App {

	public static void main(String[] args) {
		MyBean bean = new MyBean("This is Bean Sample!");
		System.out.println(bean);
	}
}

console

MyBean [message=This is Bean Sample!, date=Thu Jan 18 14:03:34 JST 2018]