Quantcast
Channel: Spring Community Forums - Data
Viewing all articles
Browse latest Browse all 297

Spring Data REST RestResource url

$
0
0
Hi all,

Is it possible to export a @RestResource in Spring Data REST with a prefixed URL like /xxx/yyy/<path>?

Now, i'm able to define such a resource:

@RestResource(exported = true, rel = "asignaturas", path = "asignaturas")
public interface AsignaturaRepository extends PagingAndSortingRepository<TfgVwAsignaturas, String>
{
@RestResource
public Page<TfgVwAsignaturas> findByNombre(@Param("nombre") String nombre, Pageable pageable);
}

But i would like to be able to access different resources through different urls:

*. /aaa/bbb/ccc/asignaturas
*. /xxx/yyy/another
*. /www/xxx/anotherone

I have seen that i can configure the WebApplicationInitializer to register a different mapping URL, but this is for the whole application and i want different prefixes for different resources ...

I have tried this, but breaks with a NPE:

@RestResource(exported = true, rel = "asignaturas", path = "/aaa/bbb/ccc/asignaturas")
public interface AsignaturaRepository extends PagingAndSortingRepository<TfgVwAsignaturas, String>
{
@RestResource
public Page<TfgVwAsignaturas> findByNombre(@Param("nombre") String nombre, Pageable pageable);
}

Thanks a lot for your help!!!!

Best regards,
Ricardo

Viewing all articles
Browse latest Browse all 297

Trending Articles