У меня есть метод, похожий на этот:
@PostMapping(path = ["/signup"],
consumes = [(MediaType.APPLICATION_JSON_UTF8_VALUE)])
fun signUp(@RequestBody dto: RegistrationDto)
: ResponseEntity<Void> {
val userId : String = dto.userInfo!!.username!!
val password : String = dto.password!!
val registered = if(!dto.secretPassword.isNullOrBlank() && dto.secretPassword.equals(adminCode)) {
authService.createUser(userId, password, setOf("ADMIN"))
} else {
authService.createUser(userId, password, setOf("USER"))
}
if (!registered) {
return ResponseEntity.status(400).build()
}
val userDetails = userDetailsService.loadUserByUsername(userId)
val token = UsernamePasswordAuthenticationToken(userDetails, password, userDetails.authorities)
authenticationManager.authenticate(token)
if (token.isAuthenticated) {
SecurityContextHolder.getContext().authentication = token
}
/**
* AMQP
*/
amqpService.send(dto.userInfo!!, "USER-REGISTRATION")
return ResponseEntity.status(204).build()
}
Если вы заметили, что у меня есть метод amqpService.send(dto.userInfo!!, "USER-REGISTRATION
, как я могу отключить этот метод, когда я работаю в режиме "разработки"?
Я хочу отключить RabbiqMQ при работе в тестовом режиме, чтобы этот метод не вызывался?
Спасибо