package com.u2ware.springfield.sample.part2.step2;
import lombok.Getter;
import lombok.Setter;
import com.u2ware.springfield.config.Springfield;
import com.u2ware.springfield.config.Springfield.Strategy;
@Springfield(
	strategy=Strategy.JPA,
	entity=FindEntity.class,
	topLevelMapping="/part2/step21"
)
public class FindByName {
	
	@Getter @Setter private String name;
}
		
package com.u2ware.springfield.sample.part2.step2;
import lombok.Getter;
import lombok.Setter;
import com.u2ware.springfield.config.Springfield;
import com.u2ware.springfield.config.Springfield.Strategy;
@Springfield(
	strategy=Strategy.JPA,
	entity=FindEntity.class,
	topLevelMapping="/part2/step22"
)
public class FindByAgeBetween {
	@Getter @Setter private Integer ageMax;
	@Getter @Setter private Integer ageMin;
}
		
package com.u2ware.springfield.sample.part2.step2;
import javax.persistence.Entity;
import javax.persistence.Id;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Entity
public @ToString class FindEntity {
	@Id
	@Getter @Setter private String id;
	@Getter @Setter private String password;
	@Getter @Setter private String name;
	@Getter @Setter private Integer age;
}
		@Springfield(strategy=Strategy.JPA, entity=FindEntity.class) 선언으로 다음 7개의 Bean 이 자동 생성, 등록 된다.
| bean name | bean type | bean implement | 
|---|---|---|
| "findByAgeBetweenController" | EntityController<FindEntity, FindByAgeBetween> | com.u2ware.springfield.controller. EntityHandler | 
| "findByAgeBetweenValidator" | EntityValidator<FindEntity, FindByAgeBetween> | com.u2ware.springfield.validation. EntityValidatorImpl | 
| "findByAgeBetweenService" | EntityService<FindEntity, FindByAgeBetween> | com.u2ware.springfield.service. EntityServiceImpl | 
| "findByNameController" | EntityController<FindEntity, FindByName> | com.u2ware.springfield.controller. EntityHandler | 
| "findByNameValidator" | EntityValidator<FindEntity, FindByName> | com.u2ware.springfield.validation. EntityValidatorImpl | 
| "findByNameService" | EntityService<FindEntity, FindByName> | com.u2ware.springfield.service. EntityServiceImpl | 
| "findEntityRepository" | EntityRepository<FindEntity, String> | com.u2ware.springfield.repository.jpa. EntityJpaRepository | 
자동생성 하려는 Bean(Name)이 이미 존재한다면, @Springfield 는 Bean 을 따로 생성하지 않는다.
| 매핑 경로 | HTTP Method | Controller Method 이름 | 예제 Command 객체 | 예제 매핑 경로 | 
|---|---|---|---|---|
| /{topLevelMapping}/ | GET | home() | FindByName | /part2/step21/ | 
| /{topLevelMapping} | GET | findForm() | FindByName | /part2/step21 | 
| /{topLevelMapping} | POST | find() | FindByName | /part2/step21 | 
| /{topLevelMapping}/{id} | GET | read() | FindEntity | /part2/step21/bar | 
| /{topLevelMapping}/new | GET | createForm() | FindEntity | /part2/step21/new | 
| /{topLevelMapping}/new | POST | create() | FindEntity | /part2/step21/new | 
| /{topLevelMapping}/{id}/edit | GET | updateForm() | FindEntity | /part2/step21/bar/eidt | 
| /{topLevelMapping}/{id}/edit | PUT | update() | FindEntity | /part2/step21/bar/eidt | 
| /{topLevelMapping}/{id}/edit | DELETE | delete() | FindEntity | /part2/step21/bar/eidt | 
| 매핑 경로 | HTTP Method | Controller Method 이름 | 예제 Command 객체 | 예제 매핑 경로 | 
|---|---|---|---|---|
| /{topLevelMapping}/ | GET | home() | FindByAgeBetween | /part2/step22/ | 
| /{topLevelMapping} | GET | findForm() | FindByAgeBetween | /part2/step22 | 
| /{topLevelMapping} | POST | find() | FindByAgeBetween | /part2/step22 | 
| /{topLevelMapping}/{id} | GET | read() | FindEntity | /part2/step22/baz | 
| /{topLevelMapping}/new | GET | createForm() | FindEntity | /part2/step22/new | 
| /{topLevelMapping}/new | POST | create() | FindEntity | /part2/step22/new | 
| /{topLevelMapping}/{id}/edit | GET | updateForm() | FindEntity | /part2/step22/baz/eidt | 
| /{topLevelMapping}/{id}/edit | PUT | update() | FindEntity | /part2/step22/baz/eidt | 
| /{topLevelMapping}/{id}/edit | DELETE | delete() | FindEntity | /part2/step22/baz/eidt | 
FindByAgeBetween 과 FindByName 이 동일 package 내에 있어, 경로가 중복되므로. @Springfield 의 topLevelMapping 속성을 을 직접 지정한다.