package com.u2ware.springfield.sample.part2.step1; import lombok.Getter; import lombok.Setter; import com.u2ware.springfield.config.Springfield; import com.u2ware.springfield.config.Springfield.Strategy; import com.u2ware.springfield.repository.QueryMethod; @Springfield( strategy=Strategy.JPA, entity=QueryEntity.class ) @QueryMethod("findByIdAndPassword") public class QueryBean { @Getter @Setter private String id; @Getter @Setter private String password; }
package com.u2ware.springfield.sample.part2.step1; import javax.persistence.Entity; import javax.persistence.Id; import lombok.Getter; import lombok.Setter; import lombok.ToString; @Entity public @ToString class QueryEntity { @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=QueryEntity.class) 선언으로 다음 4개의 Bean 이 자동 생성, 등록 된다.
bean name | bean type | bean implement |
---|---|---|
"queryBeanController" | EntityController<QueryEntity, QueryBean> | com.u2ware.springfield.controller. EntityHandler |
"queryBeanValidator" | EntityValidator<QueryEntity, QueryBean> | com.u2ware.springfield.validation. EntityValidatorImpl |
"queryBeanService" | EntityService<QueryEntity, QueryBean> | com.u2ware.springfield.service. EntityServiceImpl |
"queryEntityRepository" | EntityRepository<QueryEntity, String> | com.u2ware.springfield.repository.jpa. EntityJpaRepository |
매핑 경로 | HTTP Method | Controller Method 이름 | 예제 Command 객체 | 예제 매핑 경로 |
---|---|---|---|---|
/{topLevelMapping}/ | GET | home() | QueryBean | /part2/step1/ |
/{topLevelMapping} | GET | findForm() | QueryBean | /part2/step1 |
/{topLevelMapping} | POST | find() | QueryBean | /part2/step1 |
/{topLevelMapping}/{id} | GET | read() | QueryEntity | /part2/step1/foo |
/{topLevelMapping}/new | GET | createForm() | QueryEntity | /part2/step1/new |
/{topLevelMapping}/new | POST | create() | QueryEntity | /part2/step1/new |
/{topLevelMapping}/{id}/edit | GET | updateForm() | QueryEntity | /part2/step1/foo/eidt |
/{topLevelMapping}/{id}/edit | PUT | update() | QueryEntity | /part2/step1/foo/eidt |
/{topLevelMapping}/{id}/edit | DELETE | delete() | QueryEntity | /part2/step1/foo/eidt |