how to make RepositoryEventHandler working in spring boot
@Component
@RepositoryEventHandler({Person.class})
public class RepositoryListener {
@HandleBeforeDelete
public void handleEventBeforeDelete(Person person){
java.lang.System.out.println("handleAuthorBeforeCreate");
}
@HandleAfterDelete
public void handleEventAfterDelete(Person person){
java.lang.System.out.println("handleAuthorAfterCreate");
}
@HandleBeforeSave
public void handleEventBeforeSave(Event event){
java.lang.System.out.println("handleAuthorBeforeSave");
}
@HandleAfterSave
public void handleEventAfterSave(Perrson person){
java.lang.System.out.println("yulin-11 handleAuthorAfterSave");
}
@HandleBeforeCreate
public void handEventBeforeCreate(Person person){
java.lang.System.out.println("handEventBeforeCreate");
}
@HandleAfterCreate
public void handleEventAfterCreate(Person person){
java.lang.System.out.println("handleEventAfterCreate");
}
}
I create the RepositoryListener as above. When I fire delete and post rest call in the controller, it doesn't invoke any of those methods in the RepositoryListener. (Person is my domain class). Does anyone know what I am missing? thx!
spring-boot spring-data-jpa repository
|
show 3 more comments
@Component
@RepositoryEventHandler({Person.class})
public class RepositoryListener {
@HandleBeforeDelete
public void handleEventBeforeDelete(Person person){
java.lang.System.out.println("handleAuthorBeforeCreate");
}
@HandleAfterDelete
public void handleEventAfterDelete(Person person){
java.lang.System.out.println("handleAuthorAfterCreate");
}
@HandleBeforeSave
public void handleEventBeforeSave(Event event){
java.lang.System.out.println("handleAuthorBeforeSave");
}
@HandleAfterSave
public void handleEventAfterSave(Perrson person){
java.lang.System.out.println("yulin-11 handleAuthorAfterSave");
}
@HandleBeforeCreate
public void handEventBeforeCreate(Person person){
java.lang.System.out.println("handEventBeforeCreate");
}
@HandleAfterCreate
public void handleEventAfterCreate(Person person){
java.lang.System.out.println("handleEventAfterCreate");
}
}
I create the RepositoryListener as above. When I fire delete and post rest call in the controller, it doesn't invoke any of those methods in the RepositoryListener. (Person is my domain class). Does anyone know what I am missing? thx!
spring-boot spring-data-jpa repository
Q: What is your "repository"? For example, an Oracle 11g RDBMS? Q: How are you "firing a delete"? A stored procedure in a database? Q: What version of Spring Boot are you using? How are you running your app? In Eclipse? Tomcat? On a production server?
– paulsm4
Nov 29 '18 at 0:04
I am using intellij maven. this is my Person Repository class: public interface PersonRepository extends JpaRepository<person, personID> {}. I am using springboot 2.0.5.release.
– lin
Nov 29 '18 at 0:12
Q: So how do you "fire a delete"? What sequence of actions/events cause a "delete" to "fire"? Does a user click something on a web page? Is the database involved prior to Spring Boot getting called? What exactly leads up to this "event" your controller doesn't seem to be getting?
– paulsm4
Nov 29 '18 at 1:00
it is an REST. I am using postman localhost:8080/person/id, choose delete option to fire the controller.
– lin
Nov 29 '18 at 1:03
Got it. So the problem has nothing to do with the database: you're using Postman to invoke your Spring Boot API. SUGGESTIONS: 1) Enable verbose trace logging, 2) Use your IntelliJ debugger
– paulsm4
Nov 29 '18 at 1:07
|
show 3 more comments
@Component
@RepositoryEventHandler({Person.class})
public class RepositoryListener {
@HandleBeforeDelete
public void handleEventBeforeDelete(Person person){
java.lang.System.out.println("handleAuthorBeforeCreate");
}
@HandleAfterDelete
public void handleEventAfterDelete(Person person){
java.lang.System.out.println("handleAuthorAfterCreate");
}
@HandleBeforeSave
public void handleEventBeforeSave(Event event){
java.lang.System.out.println("handleAuthorBeforeSave");
}
@HandleAfterSave
public void handleEventAfterSave(Perrson person){
java.lang.System.out.println("yulin-11 handleAuthorAfterSave");
}
@HandleBeforeCreate
public void handEventBeforeCreate(Person person){
java.lang.System.out.println("handEventBeforeCreate");
}
@HandleAfterCreate
public void handleEventAfterCreate(Person person){
java.lang.System.out.println("handleEventAfterCreate");
}
}
I create the RepositoryListener as above. When I fire delete and post rest call in the controller, it doesn't invoke any of those methods in the RepositoryListener. (Person is my domain class). Does anyone know what I am missing? thx!
spring-boot spring-data-jpa repository
@Component
@RepositoryEventHandler({Person.class})
public class RepositoryListener {
@HandleBeforeDelete
public void handleEventBeforeDelete(Person person){
java.lang.System.out.println("handleAuthorBeforeCreate");
}
@HandleAfterDelete
public void handleEventAfterDelete(Person person){
java.lang.System.out.println("handleAuthorAfterCreate");
}
@HandleBeforeSave
public void handleEventBeforeSave(Event event){
java.lang.System.out.println("handleAuthorBeforeSave");
}
@HandleAfterSave
public void handleEventAfterSave(Perrson person){
java.lang.System.out.println("yulin-11 handleAuthorAfterSave");
}
@HandleBeforeCreate
public void handEventBeforeCreate(Person person){
java.lang.System.out.println("handEventBeforeCreate");
}
@HandleAfterCreate
public void handleEventAfterCreate(Person person){
java.lang.System.out.println("handleEventAfterCreate");
}
}
I create the RepositoryListener as above. When I fire delete and post rest call in the controller, it doesn't invoke any of those methods in the RepositoryListener. (Person is my domain class). Does anyone know what I am missing? thx!
spring-boot spring-data-jpa repository
spring-boot spring-data-jpa repository
asked Nov 28 '18 at 23:59
linlin
426
426
Q: What is your "repository"? For example, an Oracle 11g RDBMS? Q: How are you "firing a delete"? A stored procedure in a database? Q: What version of Spring Boot are you using? How are you running your app? In Eclipse? Tomcat? On a production server?
– paulsm4
Nov 29 '18 at 0:04
I am using intellij maven. this is my Person Repository class: public interface PersonRepository extends JpaRepository<person, personID> {}. I am using springboot 2.0.5.release.
– lin
Nov 29 '18 at 0:12
Q: So how do you "fire a delete"? What sequence of actions/events cause a "delete" to "fire"? Does a user click something on a web page? Is the database involved prior to Spring Boot getting called? What exactly leads up to this "event" your controller doesn't seem to be getting?
– paulsm4
Nov 29 '18 at 1:00
it is an REST. I am using postman localhost:8080/person/id, choose delete option to fire the controller.
– lin
Nov 29 '18 at 1:03
Got it. So the problem has nothing to do with the database: you're using Postman to invoke your Spring Boot API. SUGGESTIONS: 1) Enable verbose trace logging, 2) Use your IntelliJ debugger
– paulsm4
Nov 29 '18 at 1:07
|
show 3 more comments
Q: What is your "repository"? For example, an Oracle 11g RDBMS? Q: How are you "firing a delete"? A stored procedure in a database? Q: What version of Spring Boot are you using? How are you running your app? In Eclipse? Tomcat? On a production server?
– paulsm4
Nov 29 '18 at 0:04
I am using intellij maven. this is my Person Repository class: public interface PersonRepository extends JpaRepository<person, personID> {}. I am using springboot 2.0.5.release.
– lin
Nov 29 '18 at 0:12
Q: So how do you "fire a delete"? What sequence of actions/events cause a "delete" to "fire"? Does a user click something on a web page? Is the database involved prior to Spring Boot getting called? What exactly leads up to this "event" your controller doesn't seem to be getting?
– paulsm4
Nov 29 '18 at 1:00
it is an REST. I am using postman localhost:8080/person/id, choose delete option to fire the controller.
– lin
Nov 29 '18 at 1:03
Got it. So the problem has nothing to do with the database: you're using Postman to invoke your Spring Boot API. SUGGESTIONS: 1) Enable verbose trace logging, 2) Use your IntelliJ debugger
– paulsm4
Nov 29 '18 at 1:07
Q: What is your "repository"? For example, an Oracle 11g RDBMS? Q: How are you "firing a delete"? A stored procedure in a database? Q: What version of Spring Boot are you using? How are you running your app? In Eclipse? Tomcat? On a production server?
– paulsm4
Nov 29 '18 at 0:04
Q: What is your "repository"? For example, an Oracle 11g RDBMS? Q: How are you "firing a delete"? A stored procedure in a database? Q: What version of Spring Boot are you using? How are you running your app? In Eclipse? Tomcat? On a production server?
– paulsm4
Nov 29 '18 at 0:04
I am using intellij maven. this is my Person Repository class: public interface PersonRepository extends JpaRepository<person, personID> {}. I am using springboot 2.0.5.release.
– lin
Nov 29 '18 at 0:12
I am using intellij maven. this is my Person Repository class: public interface PersonRepository extends JpaRepository<person, personID> {}. I am using springboot 2.0.5.release.
– lin
Nov 29 '18 at 0:12
Q: So how do you "fire a delete"? What sequence of actions/events cause a "delete" to "fire"? Does a user click something on a web page? Is the database involved prior to Spring Boot getting called? What exactly leads up to this "event" your controller doesn't seem to be getting?
– paulsm4
Nov 29 '18 at 1:00
Q: So how do you "fire a delete"? What sequence of actions/events cause a "delete" to "fire"? Does a user click something on a web page? Is the database involved prior to Spring Boot getting called? What exactly leads up to this "event" your controller doesn't seem to be getting?
– paulsm4
Nov 29 '18 at 1:00
it is an REST. I am using postman localhost:8080/person/id, choose delete option to fire the controller.
– lin
Nov 29 '18 at 1:03
it is an REST. I am using postman localhost:8080/person/id, choose delete option to fire the controller.
– lin
Nov 29 '18 at 1:03
Got it. So the problem has nothing to do with the database: you're using Postman to invoke your Spring Boot API. SUGGESTIONS: 1) Enable verbose trace logging, 2) Use your IntelliJ debugger
– paulsm4
Nov 29 '18 at 1:07
Got it. So the problem has nothing to do with the database: you're using Postman to invoke your Spring Boot API. SUGGESTIONS: 1) Enable verbose trace logging, 2) Use your IntelliJ debugger
– paulsm4
Nov 29 '18 at 1:07
|
show 3 more comments
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53529927%2fhow-to-make-repositoryeventhandler-working-in-spring-boot%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53529927%2fhow-to-make-repositoryeventhandler-working-in-spring-boot%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Q: What is your "repository"? For example, an Oracle 11g RDBMS? Q: How are you "firing a delete"? A stored procedure in a database? Q: What version of Spring Boot are you using? How are you running your app? In Eclipse? Tomcat? On a production server?
– paulsm4
Nov 29 '18 at 0:04
I am using intellij maven. this is my Person Repository class: public interface PersonRepository extends JpaRepository<person, personID> {}. I am using springboot 2.0.5.release.
– lin
Nov 29 '18 at 0:12
Q: So how do you "fire a delete"? What sequence of actions/events cause a "delete" to "fire"? Does a user click something on a web page? Is the database involved prior to Spring Boot getting called? What exactly leads up to this "event" your controller doesn't seem to be getting?
– paulsm4
Nov 29 '18 at 1:00
it is an REST. I am using postman localhost:8080/person/id, choose delete option to fire the controller.
– lin
Nov 29 '18 at 1:03
Got it. So the problem has nothing to do with the database: you're using Postman to invoke your Spring Boot API. SUGGESTIONS: 1) Enable verbose trace logging, 2) Use your IntelliJ debugger
– paulsm4
Nov 29 '18 at 1:07