英文:
Why I'm getting 'Error mapping GraphModel' error with neo4j OGM
问题
以下是要翻译的代码部分:
Save Payout method:
@Override
@UseBookmark
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public void addEmploymentPayout(EmploymentPayoutDTO payoutDto, String employmentId) {
try {
// Map
var payout = dozerMapper.map(payoutDto, EmploymentPayout.class);
// Save
var employment = profileService.findEmploymentByUuid(employmentId);
var container = employmentPayoutContainerRepository.getContainerIfExist(employmentId)
.orElse(new EmploymentPayoutContainer());
container.setEmployment(employment);
var payouts = Optional.ofNullable(container.getEmploymentPayouts())
.orElse(new ArrayList<>());
payouts.add(payout);
container.setEmploymentPayouts(payouts);
employmentPayoutContainerRepository.save(container);
// employmentPayout.setEmploymentPayoutContainer(container);
// employmentPayoutRepository.save(payout);
// employmentPayoutRepository.save(employmentPayout, 2);
} catch (Exception e) {
LOG.error(ExceptionUtils.getStackTrace(e));
}
}
Method getAllPureEmploymentsByProfileId
:
@Query("MATCH (p:Profile) WHERE p.uuid=$profileId "
+ "MATCH (p)-[:HAS_PROFILE_EMPLOYMENT_CONTAINER]->(pec:ProfileEmploymentContainer) "
+ "MATCH path = (pec)-[:USES_PROFILE_EMPLOYMENT]-(pe:ProfileEmployment) RETURN pec, path")
ProfileEmploymentContainer getAllPureEmploymentsByProfileId( @Param("profileId") String profileId);
希望这些信息对你有所帮助。如果你有任何其他问题,请随时提出。
英文:
Inputs:
Save Payout method:
@Override
@UseBookmark
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public void addEmploymentPayout(EmploymentPayoutDTO payoutDto, String employmentId) {
try {
// Map
var payout = dozerMapper.map(payoutDto, EmploymentPayout.class);
// Save
var employment = profileService.findEmploymentByUuid(employmentId);
var container = employmentPayoutContainerRepository.getContainerIfExist(employmentId)
.orElse(new EmploymentPayoutContainer());
container.setEmployment(employment);
var payouts = Optional.ofNullable(container.getEmploymentPayouts())
.orElse(new ArrayList<>());
payouts.add(payout);
container.setEmploymentPayouts(payouts);
employmentPayoutContainerRepository.save(container);
// employmentPayout.setEmploymentPayoutContainer(container);
// employmentPayoutRepository.save(payout);
// employmentPayoutRepository.save(employmentPayout, 2);
} catch (Exception e) {
LOG.error(ExceptionUtils.getStackTrace(e));
}
}
Method getAllPureEmploymentsByProfileId
:
@Query("MATCH (p:Profile) WHERE p.uuid=$profileId "
+ "MATCH (p)-[:HAS_PROFILE_EMPLOYMENT_CONTAINER]->(pec:ProfileEmploymentContainer) "
+ "MATCH path = (pec)-[:USES_PROFILE_EMPLOYMENT]-(pe:ProfileEmployment) RETURN pec, path")
ProfileEmploymentContainer getAllPureEmploymentsByProfileId( @Param("profileId") String profileId);
Description
After saving (adding) a new EmploymentPayout
(addEmploymentPayout
), when I try to load all or part of the path (getAllPureEmploymentsByProfileId
), I get this error. But the error disappears after restarting the server.
Can you help me understand what I am doing wrong? Thanks a lot!
Error:
org.springframework.dao.InvalidDataAccessApiUsageException: Error mapping GraphModel; nested exception is org.neo4j.ogm.exception.core.MappingException: Error mapping GraphModel
at org.springframework.data.neo4j.transaction.SessionFactoryUtils.convertOgmAccessException(SessionFactoryUtils.java:125)
at org.springframework.data.neo4j.repository.support.Neo4jPersistenceExceptionTranslator.translateExceptionIfPossible(Neo4jPersistenceExceptionTranslator.java:31)
at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:61)
at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:242)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:152)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
at com.sun.proxy.$Proxy128.getAllPureEmploymentsByProfileId(Unknown Source)
at com.infotemp.neo4j.service.impl.ProfileServiceImpl.getEmploymentsForUser(ProfileServiceImpl.java:7410)
at com.infotemp.neo4j.service.impl.ProfileServiceImpl$$FastClassBySpringCGLIB$$9ac11082.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:783)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:698)
at com.infotemp.neo4j.service.impl.ProfileServiceImpl$$EnhancerBySpringCGLIB$$56efb754.getEmploymentsForUser(<generated>)
at com.infotemp.neo4j.service.impl.VacationCompensationAccountServiceImpl.getProfileEmployments(VacationCompensationAccountServiceImpl.java:536)
at com.infotemp.neo4j.service.impl.VacationCompensationAccountServiceImpl.getCurrentEmployment(VacationCompensationAccountServiceImpl.java:73)
at com.infotemp.neo4j.service.impl.VacationCompensationAccountServiceImpl$$FastClassBySpringCGLIB$$18090ab5.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:783)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:698)
at com.infotemp.neo4j.service.impl.VacationCompensationAccountServiceImpl$$EnhancerBySpringCGLIB$$5ea6899a.getCurrentEmployment(<generated>)
at com.infotemp.controller.ProfileController.getVacationCompansation(ProfileController.java:2096)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1067)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:655)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
at org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:182)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90)
at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:354)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:359)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:889)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1735)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.neo4j.ogm.exception.core.MappingException: Error mapping GraphModel
at org.neo4j.ogm.context.GraphEntityMapper.mapContentOf(GraphEntityMapper.java:164)
at org.neo4j.ogm.context.GraphEntityMapper.lambda$map$2(GraphEntityMapper.java:115)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at org.neo4j.ogm.context.GraphEntityMapper.map(GraphEntityMapper.java:117)
at org.neo4j.ogm.context.GraphRowModelMapper.map(GraphRowModelMapper.java:60)
at org.neo4j.ogm.session.delegates.ExecuteQueriesDelegate.lambda$executeAndMap$1(ExecuteQueriesDelegate.java:165)
at org.neo4j.ogm.session.Neo4jSession.doInTransaction(Neo4jSession.java:590)
at org.neo4j.ogm.session.Neo4jSession.doInTransaction(Neo4jSession.java:564)
at org.neo4j.ogm.session.delegates.ExecuteQueriesDelegate.executeAndMap(ExecuteQueriesDelegate.java:150)
at org.neo4j.ogm.session.delegates.ExecuteQueriesDelegate.query(ExecuteQueriesDelegate.java:117)
at org.neo4j.ogm.session.Neo4jSession.query(Neo4jSession.java:425)
at jdk.internal.reflect.GeneratedMethodAccessor114.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:282)
at org.springframework.data.neo4j.transaction.SharedSessionCreator$SharedSessionInvocationHandler.lambda$invoke$1(SharedSessionCreator.java:121)
at org.springframework.data.neo4j.transaction.SharedSessionCreator$SharedSessionInvocationHandler.invokeInTransaction(SharedSessionCreator.java:159)
at org.springframework.data.neo4j.transaction.SharedSessionCreator$SharedSessionInvocationHandler.invoke(SharedSessionCreator.java:123)
at com.sun.proxy.$Proxy89.query(Unknown Source)
at org.springframework.data.neo4j.repository.query.GraphQueryExecution$SingleEntityExecution.execute(GraphQueryExecution.java:68)
at org.springframework.data.neo4j.repository.query.GraphRepositoryQuery.doExecute(GraphRepositoryQuery.java:76)
at org.springframework.data.neo4j.repository.query.AbstractGraphRepositoryQuery.execute(AbstractGraphRepositoryQuery.java:57)
at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor$QueryMethodInvoker.invoke(QueryExecutorMethodInterceptor.java:195)
at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:152)
at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:130)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137)
... 120 more
Caused by: java.lang.NullPointerException
at org.neo4j.ogm.session.Utils.coerceTypes(Utils.java:79)
at org.neo4j.ogm.metadata.FieldInfo.write(FieldInfo.java:449)
at org.neo4j.ogm.context.GraphEntityMapper.createRelationshipEntity(GraphEntityMapper.java:419)
at org.neo4j.ogm.context.GraphEntityMapper.mapRelationshipEntity(GraphEntityMapper.java:354)
at org.neo4j.ogm.context.GraphEntityMapper.mapRelationships(GraphEntityMapper.java:330)
at org.neo4j.ogm.context.GraphEntityMapper.mapContentOf(GraphEntityMapper.java:158)
... 150 more
I tried to add these annotations but it didn't help:
@UseBookmark
@Transactional(rollbackFor = Exception.class,
propagation = Propagation.REQUIRED)
UPD
I don't have that problem with standalone (no clusters) Neoj4 server.
答案1
得分: 1
I found out what caused this problem. It was the call of this asynchronous method:
emailService.sendPayoutCreatedEmailAsync(employmentId, payout, userDetails); // fire-and-forget
The method above is called just after the addEmploymentPayout
one.
This is a definition of this method which is called another non-ansync method - sendPayoutCreatedEmail
(this method has calls to repository methods):
@Override
public CompletableFuture<Void> sendPayoutCreatedEmailAsync(String employmentId, EmploymentPayoutDTO payout, InfotempUserDetails userDetails) {
var future = CompletableFuture.runAsync(() -> {
this.sendPayoutCreatedEmail(employmentId, payout, userDetails);
});
return future;
}
SOLUTION:
It works (don't know how, but it does) if you change the asynchronous method call to a call from a new thread. Like this:
new Thread(() -> {
emailService.sendPayoutCreatedEmail(employmentId, payout, userDetails);
}).start();
英文:
I found out what caused this problem. It was the call of this asynchronous method:
emailService.sendPayoutCreatedEmailAsync(employmentId, payout, userDetails); // fire-and-forget
The method above is called just after the addEmploymentPayout
one.
This is a definition of this method which is called another non-ansync method - sendPayoutCreatedEmail
(this method has calls to repository methods):
@Override
public CompletableFuture<Void> sendPayoutCreatedEmailAsync(String employmentId, EmploymentPayoutDTO payout, InfotempUserDetails userDetails) {
var future = CompletableFuture.runAsync(() -> {
this.sendPayoutCreatedEmail(employmentId, payout, userDetails);
});
return future;
}
SOLUTION:
It works (don't know how, but it does) if you change the asynchronous method call to a call from a new thread. Like this:
new Thread(() -> {
emailService.sendPayoutCreatedEmail(employmentId, payout, userDetails);
}).start();
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论