我有问题要为我的存储库公开RevisionRepository
(Spring Data Envers)端点,扩展RevisionRepository
如下所示:
@RepositoryRestResource(path = "disciplines", itemResourceRel = "disciplines")
public interface DisciplineRepository extends
RevisionRepository<Discipline, Integer, Integer>,
CrudRepository<Discipline, Integer>{
@RestResource(path = "findByName", rel = "findByName")
List<Discipline> findByName(String name);
}
只公开findByName
方法,有没有其他方法可以公开RevisionRepository
中的方法?我也尝试在DisciplineRepository
中覆盖这些方法,但它不起作用。
谢谢......
答案 0 :(得分:6)
您必须编写自定义控制器方法来实现此功能,如下所示:
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'Axxxxxxxxxxxxxxxxxx' );
$registrationIds = array("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" );
// prep the bundle
$msg = array
(
'message' => 'here is a message. message',
'title' => 'This is a title. title',
'subtitle' => 'This is a subtitle. subtitle',
'tickerText' => 'Ticker text here...Ticker text here...Ticker text here',
'vibrate' => 1,
'sound' => 1
);
$fields = array
(
'registration_ids' => $registrationIds,
'data' => $msg
);
$headers = array
(
'Authorization: key=' . API_ACCESS_KEY,
'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt( $ch,CURLOPT_URL, 'https://android.googleapis.com/gcm/send' );
curl_setopt( $ch,CURLOPT_POST, true );
curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) );
$result = curl_exec($ch );
curl_close( $ch );
echo $result;
?>