Using Spring loaded in spring mvc framework

帅比萌擦擦* 提交于 2020-01-14 09:05:36

问题


I am having some issues using spring loaded with spring mvc. I added the spring loaded jar as a java agent on the server.

Now when I added new methods for instance in my case I added a new method testHomes(), and it gives me with this dialog.

Below is my config

I also checked Build Automatically I am using spring framework 4.2.5.RELEASE.

I checked from the following link SpringLoaded

Unlike 'hot code replace' which only allows simple changes once a JVM is running (e.g. changes to method bodies), Spring Loaded allows you to add/modify/delete methods/fields/constructors. The annotations on types/methods/fields/constructors can also be modified and it is possible to add/remove/change values in enum types.

IS there any way I can make this work ?

Regards,


回答1:


What is Hot Code Replace?:

Hot code replace (HCR) is a debugging technique whereby the Eclipse Java debugger transmits new class files over the debugging channel to another JVM. In the case of Eclipse development, this also applies to the VM that runs the runtime workbench. The idea is that you can start a debugging session on a given runtime workbench and change a Java file in your development workbench, and the debugger will replace the code in the receiving VM while it is running. No restart is required, hence the reference to "hot".

When it works:

HCR only works when the class signature does not change; you cannot remove or add fields to existing classes, for instance. However, HCR can be used to change the body of a method. HCR is reliably implemented only on 1.4.1 VMs and later, or using any version of the IBM J9 VM. J9 is available in IBM products such as Websphere Studio Device Developer.

Troubleshooting the problem:

  1. Check you are running the application on a supported VM (taking note that the JVM that runs Eclipse may not be the same as the JVM that is running your Java application).

  2. Check whether automatic building turned on. Make sure that 'Project> Build Automatically' is checked.

  3. Check the following option being selected on Eclipse Tomcat Server.

References:wiki.eclipse




回答2:


javaagent is JVM option. So it should be passed without D prefix. i.e. you need

-javaagent:springloaded-1.2.5.RELEASE.jar -noverify


来源:https://stackoverflow.com/questions/36944042/using-spring-loaded-in-spring-mvc-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!