Guest User

Untitled

a guest
Feb 21st, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. @SpringBootApplication
  2. public class Application {
  3.  
  4. public static void main(String[] args) {
  5. SpringApplication.run(ServiceNowMediatorApplication.class, args);
  6. }
  7. @Bean
  8. public Alert b(){
  9. return new B();
  10. }
  11.  
  12.  
  13. @Bean
  14. public ServiceB serviceB(B b){
  15. return new ServiceB(b);
  16. }
  17.  
  18. }
  19.  
  20. @RestController
  21. @RequestMapping("/{database}/alerts")
  22. public class ControllerB {
  23. @Autowired private ServiceB serviceB;
  24.  
  25. @Autowired
  26. private B b;
  27.  
  28. @Autowired
  29. ControllerB(B b,ServiceB serviceB){
  30. this.b = b;
  31. this.serviceB = serviceB;
  32. }
  33.  
  34. @RequestMapping(method = RequestMethod.POST)
  35. public B dosomethingCrazy(@RequestBody BImpl bimpl) {
  36.  
  37.  
  38. String response = serviceB.dosomethingImportant();
  39. return bimpl;
  40.  
  41. }
  42.  
  43. }
  44.  
  45. @Autowired
  46. public B b;
  47.  
  48. @Autowired
  49. public B getB() {
  50. return b;
  51. }
  52.  
  53. @Autowired
  54. public void setB(B b) {
  55. this.b = b;
  56. }
  57.  
  58. @Autowired
  59. public ServiceB(B b){
  60. this.b = b;
  61.  
  62. }
  63.  
  64. public String dosomethingimportant() {
  65. b.getValueOfFieldPassedInPOST(field1) ==> THIS RETURNS A NULL
  66. }
  67.  
  68. @RequestMapping(method = RequestMethod.POST)
  69. public B dosomethingCrazy(@RequestBody BImpl bimpl) {
  70.  
  71. **serviceB.setB(bimpl);**
  72. String response = serviceB.dosomethingImportant();
  73. return bimpl;
  74.  
  75. }
Add Comment
Please, Sign In to add comment