minor upgrade (#2259)
* minor logging fix * spring security sso * use basic auth * use form login * cleanup * cleanup * final cleanup * second client app for sso * spring boot bootstrap * add logic * cleanup * add simple controller * add thymeleaf and security * minor fix * minor fix * add more boot properties * fix live test * fix live test * minor fix * semaphores * fix configuration * kotlin collection * add more collection examples * minor upgrade
This commit is contained in:
committed by
Grzegorz Piwowarek
parent
470ac0c7bb
commit
8739094a16
@@ -115,7 +115,7 @@
|
||||
|
||||
<org.springframework.version>4.3.4.RELEASE</org.springframework.version>
|
||||
|
||||
<org.springframework.data.version>1.9.6.RELEASE</org.springframework.data.version>
|
||||
<org.springframework.data.version>1.10.4.RELEASE</org.springframework.data.version>
|
||||
|
||||
<rest-assured.version>2.9.0</rest-assured.version>
|
||||
<querydsl.version>4.1.4</querydsl.version>
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.baeldung.event;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.mongodb.core.MongoOperations;
|
||||
import org.springframework.data.mongodb.core.mapping.event.AbstractMongoEventListener;
|
||||
import org.springframework.data.mongodb.core.mapping.event.BeforeConvertEvent;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
public class CascadeSaveMongoEventListener extends AbstractMongoEventListener<Object> {
|
||||
@@ -11,7 +12,8 @@ public class CascadeSaveMongoEventListener extends AbstractMongoEventListener<Ob
|
||||
private MongoOperations mongoOperations;
|
||||
|
||||
@Override
|
||||
public void onBeforeConvert(final Object source) {
|
||||
public void onBeforeConvert(final BeforeConvertEvent<Object> event) {
|
||||
final Object source = event.getSource();
|
||||
ReflectionUtils.doWithFields(source.getClass(), new CascadeCallback(source, mongoOperations));
|
||||
}
|
||||
}
|
||||
@@ -4,14 +4,16 @@ import org.baeldung.model.User;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.mongodb.core.MongoOperations;
|
||||
import org.springframework.data.mongodb.core.mapping.event.AbstractMongoEventListener;
|
||||
import org.springframework.data.mongodb.core.mapping.event.BeforeConvertEvent;
|
||||
|
||||
public class UserCascadeSaveMongoEventListener extends AbstractMongoEventListener<Object> {
|
||||
@Autowired
|
||||
private MongoOperations mongoOperations;
|
||||
|
||||
@Override
|
||||
public void onBeforeConvert(final Object source) {
|
||||
if (source instanceof User && ((User) source).getEmailAddress() != null) {
|
||||
public void onBeforeConvert(final BeforeConvertEvent<Object> event) {
|
||||
final Object source = event.getSource();
|
||||
if ((source instanceof User) && (((User) source).getEmailAddress() != null)) {
|
||||
mongoOperations.save(((User) source).getEmailAddress());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user