[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Spring Boot and Hot Deployment  XML
Forum Index -> Development
Author Message

Power User

Joined: 21/11/2007 12:23:06
Messages: 5258

(...issue was aksed by mail - response is given through forum...)


by default the Maven/Gradle project with using Spring Boot is set up in a way that all the "xxx.xxx.view.managedebeans" classes are hot deployed during development. Other packages (you might e.g. have "xxx.xxx.services") are not hot deployed.

The UI classes ("XxxxUI" in "xxx.xxx.view.managedbeans") may be implemented as "@Component" so that instances are not created by "new XxxxUI()" but by using the SpringContext. The creation of the SrpingContext is taken over by the Dispatcher-class - and the creation is done in a way that the SpringContext knows about the hot-deployment-classloader.

Now...: if from the "XxxxUI" class there is access to a service (e.g. by using "@Autowired" - this is no problem at all...

But: there is a problem when also expanding the hot-deployment from the UI-classes to the service classes - so that also the service classes are hot deployed. In this case Spring does not find theses classes and auto-wiring does not work anymore.

What in this case you have to do: override the following method in your Dispatcher:

     protected String[] findBasePackages()
         return new String[] 
             "xxx.xxx.view", // the view package
             "xxx.xxx.services", // the services package

The packages you define here are the ones that are passed into the SpringContext for finding classes...

...hope this text is not too confusing...! ;-)

Kind regards! Björn

Björn Müller, CaptainCasa GmbH
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team