spring-projects / spring-projects/spring-data-rest
Spring data does not expose default repository rest resource in domain class name is Camel case [DATAREST-402]
@odrotbohm is already working on this.
Since Dec 31, 2020.
- Dominant language
- Java
- Stars
- 958
- Forks
- 568
- PR merge metrics
- No merged PRs in 30d
Description
Vijay Kumar Rajput opened DATAREST-402 and commented
Spring Data REST does not exposes a collection resource named after the uncapitalized, pluralized version of the domain classes if class name is Camel Case.
// Domain class
@Entity
@Table(name=StoreType.TABLE_NAME)
public class StoreType implements Serializable {
protected final static String TABLE_NAME="store_type";
@Id
@Column(name="STORE_TYPE_ID", unique=true, nullable=false)
@TableGenerator(name = Store.TABLE_NAME, table = "LMC_GENERATED_KEYS", pkColumnName = "ID", valueColumnName = "LAST_VALUE", pkColumnValue = Store.TABLE_NAME, allocationSize = 1)
@GeneratedValue(strategy = GenerationType.TABLE, generator = Store.TABLE_NAME)
private short storeTypeId;
// setter and getters
}
// Repository
public interface StoreTypeRepository extends PagingAndSortingRepository<StoreType, Short> { }
I got 404 when I hit-
http://localhost:8080/myapp/jpa/storetypes
In case if I change domain class name to Storetype then above url gives me successful response. Since I don't want to change my class name so I have used @RepositoryRestResource(path="/storetypes") on the repository.
Affects: 2.1 GA (Dijkstra)
Reference URL: http://stackoverflow.com/questions/26559019/spring-rest-data-plural-url/
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.