「Spring」注釈型@ConstructorPropertiesのサンプル
説明
コンストラクタの注釈。構築されたオブジェクトの getter メソッドにこのコンストラクタのパラメータがどのように対応するかを示します。
サンプルコード
package com.arkgame.study;
public class UserBean {
private int age;
private String username;
private String userId;
@ConstructorProperties({"age","username","userId"})
public UserBean(int age, String username,String userId) {
this.age = age;
this.username = username;
this.userId = userId;
}
}
package com.arkgame.study;
public class UserBean {
private int age;
private String username;
private String userId;
@ConstructorProperties({"age","username","userId"})
public UserBean(int age, String username,String userId) {
this.age = age;
this.username = username;
this.userId = userId;
}
}
package com.arkgame.study; public class UserBean { private int age; private String username; private String userId; @ConstructorProperties({"age","username","userId"}) public UserBean(int age, String username,String userId) { this.age = age; this.username = username; this.userId = userId; } }