java - Thirdy party dependencies in custom class loader(SpringBoot, tomcat). -
i hosting springboot1.2.3 app on tomcat, compiles , run java classes dynamically.
i have custom class-loader compiles , load source code @ run-time, using java compiler api.
now want allow third party dependencies in compilable code.
i tried using urlclassloader load dependencies jar files. however, urlclassloader doesnt work when deployed on tomcat, security policy of tomcat prohibiting this.
i tried adding dependencies in application , sharing custom class-loader(which again doesn't work)
e.g. if want compile , run following code dynamically
package a.test; import a.aclass; import org.junit.test; import static org.hamcrest.corematchers.is; import static org.junit.assert.assertthat; public class atestclass { @test public void testme() { assertthat(1, is(new a.aclass().getone())); } @test public void testmeagain() { assertthat(1, is(new aclass().gettwo())); } }
now, how can provide junit dependencies compilation ?
Comments
Post a Comment