These are chat archives for HotswapProjects/user

4th
Nov 2016
iwkse
@iwkse
Nov 04 2016 00:25
Hi, I was searching more info about the spring plugin. I've been reading a post of two years ago saying the plugin doesn't support spring context reloading. Is it still like this? I found this link but it gives 404 http://hotswapagent.org/ha-plugins/spring-plugin
Vladimir Dvorak
@skybber
Nov 04 2016 07:13
Hi, I'm not author of Spring plugin, but look at this : https://github.com/HotswapProjects/HotswapAgent/blob/master/plugin/hotswap-agent-spring-plugin/README.md
Regarding to hotswap agent pages, we had problems with joomla therefore we are just migrating to github-pages.
Jiri Bubnik
@edudant
Nov 04 2016 08:39
Hi, full context reload is not what you want - the time needed is similar to full application restart. Spring plugin supports reload of a spring bean with all dependencies. Resolving of spring beans is currently based on class path scanning, hence only beans discovered by class path are supported (e.g. not xml configured beans).
iwkse
@iwkse
Nov 04 2016 10:38
@edudant Hi, I'm using alfresco (which takes a lot to restart) and I know JRebel supports that (also web resources), is it still the case?
iwkse
@iwkse
Nov 04 2016 11:25
Just now a friend of mine using JRebel told me the xml configured beans works almost instantly
I never used it so I cannot tell
Jiri Bubnik
@edudant
Nov 04 2016 13:26
Yes, this is the missing feature - xml configured beans
iwkse
@iwkse
Nov 04 2016 13:26
I beleive it's not feasible because the approach is different from JRebel
Jiri Bubnik
@edudant
Nov 04 2016 13:27
we support discovered by classpath scan (usually configured by annotation @Service etc.)
iwkse
@iwkse
Nov 04 2016 13:27
as you say..it would require a complete reload
yeah but I already love it the way it is right now
Jiri Bubnik
@edudant
Nov 04 2016 13:28
no it does not. Simple implementation would be to register xml beans and reload. More complex would be to parse XML file, diff the context and refresh only changed beans (this is the way JRebel implements)
iwkse
@iwkse
Nov 04 2016 13:28
ahh...
interesting
so in theory it can also be implemented the same way in hotswap
Jiri Bubnik
@edudant
Nov 04 2016 13:29
using Spring classes this is not as complex as it sounds, but it takes a couple of days neverless
iwkse
@iwkse
Nov 04 2016 13:29
I see..I wish I had more competence on this field, I'll like to do it but I'm new to such technology
Jiri Bubnik
@edudant
Nov 04 2016 13:30
you are welcommed :) I know roughly how to do it, but I am currenlty more then fully allocated on a business project
iwkse
@iwkse
Nov 04 2016 13:30
well..let's see :) I'm into open source but pretty new to java world :)
Jiri Bubnik
@edudant
Nov 04 2016 13:31
ok. have a look at current source code and if you have any question, you can ask.
iwkse
@iwkse
Nov 04 2016 13:31
maybe you can roughly tell me where to look to read/understand the code andt ry to do it
yeah :)
Jiri Bubnik
@edudant
Nov 04 2016 13:33
you need to have some knowladge of Spring internals as well
iwkse
@iwkse
Nov 04 2016 13:33
true
so that's basically playing with Spring to allow that
this is how hotswap deals with it
Jiri Bubnik
@edudant
Nov 04 2016 13:34
you need to implement similar to ClassPathBeanDefinitionScannerAgent , SpringPlugin#registerComponentScanBasePackage, ClassPathBeanRefreshCommand
iwkse
@iwkse
Nov 04 2016 13:34
thanks I will take a look and ask questions here
Jiri Bubnik
@edudant
Nov 04 2016 13:35
ok
iwkse
@iwkse
Nov 04 2016 14:12
so as I understood well, hotswap is capable of discovering changes in bean implementation but not in register/configuration (xml file). At lower level means there's not xml parse at all?
Jiri Bubnik
@edudant
Nov 04 2016 15:22
Yes, you need to catch ResourceFileEvent on spring Configuration files. Then parse the file using Spring utilities and discover difference with old version. Then create BeanDefinition and create / refresh Spring bean (similar to ClassPathBeanDefinitionScannerAgent.defineBean
iwkse
@iwkse
Nov 04 2016 15:25
:thumbsup:
iwkse
@iwkse
Nov 04 2016 16:33
the filter could be like that? @OnResourceFileEvent(path = "/", filter = ".*.xml")
I think more like "*.xml"
in alfresco not all xml files are spring files
iwkse
@iwkse
Nov 04 2016 16:38
taking this as example where it catches the JSF resource bundle @OnResourceFileEvent(path = "/", filter = ".*.properties")
I think I found it out
it must be "*-context.xml"
these are spring conf files
iwkse
@iwkse
Nov 04 2016 19:14
yes it's okey, it's being dectected when it's saved