Skip to main content

Reloading class using spring-loaded Jar

As a  java developer using eclipse, every time, when we made the change on the class, annotation or the xml files, eclipse will pop up a message let us decide ‘continue, restart  tomcat and more’. I am kind of appreciate its kindness. However,  most of the time, I have to select ‘restart’. So, I just wish eclipse  or tomcat can help to reload class files and don’t bother me that option.

Before, I found jRebel which is perfect for my wishing. It is just hard to push management team pay for that  $365 per license annually.

So, I need to cater myself and the one I can afford which is $0 a year, and it’s using Apache License.

How to config?

#2 in your eclipse, adding below arguments in the VM arguments. You need to amend the path to the jar file in your machine.

-Djavaagent:C:/Dev/lib/springloaded-1.1.2.20130430.jar –noverify

#3 Ready to go

Comments

  1. in my case it worked as:
    -javaagent:/path_to_jar/springloaded.jar -noverify

    ReplyDelete
  2. Thanks. Yours are more generic :)

    ReplyDelete
  3. On a Windows Service tomcat installation I found that I had to use

    -Xverify:none
    -javaagent:"C:\path_to_jar\springloaded-1.2.1.RELEASE.jar"

    notice I used -Xverify:none instead of -noverify, otherwise it woudn't recognize the command, spent hours troubleshooting because of that little detail.

    I find that it works great for changing method bodies or constructors, but it doesn't actually let me add new methods or fields, they don't get recognized until I restart the app, which is a bummer, and it's strange because their documentation says otherwise.

    Does anybody have the same problem? JVM has java 7 but the project's source level is set to java 6

    ReplyDelete
  4. is it work on tomcat jee

    ReplyDelete
  5. The hephen before noverify is not formatted properly for copying and pasting over but it works after I replaced it (with correct mapping of course).

    ReplyDelete

Post a Comment

Popular posts from this blog

Stretch a row if data overflows in jasper reports

It is very common that some columns of the report need to stretch to show all the content in that column. But  if you just specify the property " stretch with overflow' to that column(we called text field in jasper report world) , it will just stretch that column and won't change other columns, so the row could be ridiculous. Haven't find the solution from internet yet. So I just review the properties in iReport one by one and find two useful properties(the bold highlighted in example below) which resolve the problems.   example:
<band height="20" splitType="Stretch"> <textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true"> <reportElement stretchType="RelativeToTallestObject" mode="Opaque" x="192" y="0" width="183" height="20"/> <box leftPadding="2"> <pen lineWidth="0.25"/> …

JasperReports - Configuration Reference

Spring - Operations with jdbcTemplate

This class manages all the database communication and exception handling using a java.sql.Connection that is obtained from the provided DataSource. JdbcTemplate is a stateless and threadsafe class and you can safely instantiate a single instance to be used for each DAO.


Use of Callback Methods
JdbcTemplate is based on a template style of programming common to many other parts of Spring. Some method calls are handled entirely by the JdbcTemplate, while others require the calling class to provide callback methods that contain the implementation for parts of the JDBC workflow. This is another form of Inversion of Control. Your application code hands over the responsibility of managing the database access to the template class. The template class in turn calls back to your application code when it needs some detail processing filled in. These callback methods are allowed to throw a java.sql.SQLException, since the framework will be able to catch this exception and use its built-in excepti…