Created
June 28, 2020 23:01
-
-
Save itasyurt/d00bbb1e74c48e91fa2ee3fdfba34373 to your computer and use it in GitHub Desktop.
REST Controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RestController | |
@RequestMapping("/api") | |
class DummyController { | |
@Autowired | |
lateinit var applicationContext: ApplicationContext | |
@Autowired | |
lateinit var busProperties: BusProperties | |
@Autowired | |
lateinit var state:State | |
@RequestMapping("", method = [RequestMethod.GET]) | |
fun getResult(): Int { | |
return state.data | |
} | |
@RequestMapping("", method = [RequestMethod.PUT]) | |
fun updateData(@RequestParam newData: Int) { | |
val id = busProperties.id | |
val event = UpdateDataEvent(this, id, newData) | |
applicationContext.publishEvent(event) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment