0

I have create with Spring 4 MVC a rest services. I would create/remove and mantainance services at runtime without stop all rest services . Is it possible with Groovy framework or another framework?

Thanks in advance

Davide Dell'Olio
  • 83
  • 1
  • 2
  • 6
  • Yes, you can add RestController with Spring 4 in Groovy, in fact Spring Boot CLI does just that, it provides a way to create simple mock ups in groovy. – 11thdimension Apr 27 '16 at 15:06
  • I will must deploy the web application on Oracle Weblogic. Have you a example? – Davide Dell'Olio Apr 27 '16 at 15:48
  • Check out this code, it's as simple as creating a REST Controller just like in Java, https://github.com/chiquitinxx/springboot-rest-demo/blob/master/src/main/groovy/hello/HelloController.groovy, Spring boot application can be deployed as a WAR into a container. – 11thdimension Apr 27 '16 at 15:56
  • Thank you. But this is for Spring boot application and not for Spring MVC. – Davide Dell'Olio Apr 27 '16 at 16:18
  • Are you asking specifically how to create a controller in groovy with spring? or about how you can use the power of groovy metaprogramming to change the services on the fly without reloading the app? – rhinds Apr 27 '16 at 16:19
  • I would use the power of groovy metaprogramming to change services on the fly without reloading the app. Thank you – Davide Dell'Olio Apr 27 '16 at 16:27
  • I have never done this myself, but I would be wary of some of the potential problems this might introduce in a production system. Two main problems you might face are: Spring sets up its context at startup (generally speaking, not always though), so I would be suprised if it was simple to change the routing/endpoints on the fly (as Spring will have done the component scan upfront to determine endpoints/controllers - so you would have to dynamically mess with the Spring context) – rhinds Apr 27 '16 at 16:31
  • Further to this, dynamically changing your application in production can lead to unknown/inconsistent states (of the application logic) - and is hard to manage exactly what the state of your app/API is if people have been making changes - and debugging a problem will become a nightmare. – rhinds Apr 27 '16 at 16:32
  • However, if Weblogic has the capability of reloading a WAR file without downtime (e.g. load a new WAR context and once fully loaded switch the old context over) - you could look at something like this: http://stackoverflow.com/a/29958374/258813 and use property files to turn controllers on/off and reload the app. – rhinds Apr 27 '16 at 16:35

0 Answers0