{"id":709,"date":"2011-11-04T19:41:00","date_gmt":"2011-11-04T19:41:00","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/2012\/10\/osgi-and-spring-dynamic-modules-simple-hello-world.html"},"modified":"2012-10-21T20:43:24","modified_gmt":"2012-10-21T20:43:24","slug":"osgi-and-spring-dynamic-modules-simple","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2011\/11\/osgi-and-spring-dynamic-modules-simple.html","title":{"rendered":"OSGI and Spring Dynamic Modules \u2013 Simple Hello World"},"content":{"rendered":"<div dir=\"ltr\" style=\"text-align: left\">In this pose st, we\u2019ll take the <a href=\"http:\/\/www.javacodegeeks.com\/2011\/11\/osgi-simple-hello-world-with-services.html\">first implementation we made using OSGi<\/a> and use <strong>Spring Dynamic Modules<\/strong> to improve the application.<\/p>\n<p>Spring Dynamic Modules (Spring Dm) makes the development of <strong>OSGi-based<\/strong> applications a lot more easier. With that, the deployment of services is a lot easier. You can inject services like any other Spring beans.<\/p>\n<p>So let\u2019s start with Spring dm.<\/p>\n<p>First of all, you need to download the <a href=\"http:\/\/www.springsource.com\/download\/community\/?project=Spring%20Dynamic%20Modules&amp;version=1.2.1\">Spring Dm Distribution<\/a>. For this article, I used the distributions with dependencies and I will only use this libraries :<\/p>\n<pre class=\"brush: bash\">com.springsource.net.sf.cglib-2.1.3.jar\r\ncom.springsource.org.aopalliance-1.0.0.jar\r\nlog4j.osgi-1.2.15-SNAPSHOT.jar\r\ncom.springsource.slf4j.api-1.5.0.jar\r\ncom.springsource.slf4j.log4j-1.5.0.jar\r\ncom.springsource.slf4j.org.apache.commons.logging-1.5.0.jar\r\norg.springframework.aop-2.5.6.SEC01.jar\r\norg.springframework.beans-2.5.6.SEC01.jar\r\norg.springframework.context-2.5.6.SEC01.jar\r\norg.springframework.core-2.5.6.SEC01.jar\r\nspring-osgi-core-1.2.1.jar\r\nspring-osgi-extender-1.2.1.jar\r\nspring-osgi-io-1.2.1.jar\r\n<\/pre>\n<p>Of course, you can replace the Spring 2.5.6 libraries with the Spring 3.0 libraries. But for this article, Spring 2.5.6 will be enough.<\/p>\n<p>So, start with the service bundle. If we recall, this bundle exported a single service :<\/p>\n<pre class=\"brush: java\">package com.bw.osgi.provider.able;\r\n \r\npublic interface HelloWorldService {\r\n    void hello();\r\n}\r\n<\/pre>\n<pre class=\"brush: java\">package com.bw.osgi.provider.impl;\r\n \r\nimport com.bw.osgi.provider.able.HelloWorldService;\r\n \r\npublic class HelloWorldServiceImpl implements HelloWorldService {\r\n    @Override\r\n    public void hello(){\r\n        System.out.println(\"Hello World !\");\r\n    }\r\n}\r\n<\/pre>\n<p>There is no changes to do here. Now, we can see the activator :<\/p>\n<pre class=\"brush: java\">package com.bw.osgi.provider;\r\n \r\nimport org.osgi.framework.BundleActivator;\r\nimport org.osgi.framework.BundleContext;\r\nimport org.osgi.framework.ServiceRegistration;\r\n \r\nimport com.bw.osgi.provider.able.HelloWorldService;\r\nimport com.bw.osgi.provider.impl.HelloWorldServiceImpl;\r\n \r\npublic class ProviderActivator implements BundleActivator {\r\n    private ServiceRegistration registration;\r\n \r\n    @Override\r\n    public void start(BundleContext bundleContext) throws Exception {\r\n        registration = bundleContext.registerService(\r\n                HelloWorldService.class.getName(),\r\n                new HelloWorldServiceImpl(),\r\n                null);\r\n    }\r\n \r\n    @Override\r\n    public void stop(BundleContext bundleContext) throws Exception {\r\n        registration.unregister();\r\n    }\r\n}\r\n<\/pre>\n<p>So, here, we\u2019ll make simple. Let\u2019s delete this class, this is not useful anymore with Spring Dm.<\/p>\n<p>We\u2019ll let Spring Dm export the bundle for us. We\u2019ll create a Spring context for this bundle. We just have to create a file provider-context.xml in the folder <i>META-INF\/spring<\/i>. This is a simple context in XML file but we use a new namespace to register service, \u201c<i>http:\/\/www.springframework.org\/schema\/osgi<\/i>\u201c. So let\u2019s start :<\/p>\n<pre class=\"brush: xml\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;beans xmlns=\"http:\/\/www.springframework.org\/schema\/beans\"\r\n       xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\r\n       xmlns:osgi=\"http:\/\/www.springframework.org\/schema\/osgi\"\r\n       xmlns:context=\"http:\/\/www.springframework.org\/schema\/context\"\r\n       xsi:schemaLocation=\"\r\n            http:\/\/www.springframework.org\/schema\/beans\r\n            http:\/\/www.springframework.org\/schema\/beans\/spring-beans-3.0.xsd\r\n            http:\/\/www.springframework.org\/schema\/osgi\r\n            http:\/\/www.springframework.org\/schema\/osgi\/spring-osgi.xsd\"&gt;\r\n \r\n    &lt;bean id=\"helloWorldService\" class=\"com.bw.osgi.provider.impl.HelloWorldServiceImpl\"\/&gt;\r\n \r\n    &lt;osgi:service ref=\"helloWorldService\" interface=\"com.bw.osgi.provider.able.HelloWorldService\"\/&gt;\r\n&lt;\/beans&gt;\r\n<\/pre>\n<p>The only thing specific to OSGi is the osgi:service declaration. This line indicates that we register the <i>helloWorldService<\/i> as an OSGi service using the interface <i>HelloWorldService<\/i> as the name of the service.<\/p>\n<p>If you put the context file in the <i>META-INF\/spring folder<\/i>, it will be automatically detected by the Spring Extender and an application context will be created.<\/p>\n<p>We can now go to the consumer bundle. In the first phase, we created that consumer :<\/p>\n<pre class=\"brush: java\">package com.bw.osgi.consumer;\r\n \r\nimport javax.swing.Timer;\r\n \r\nimport java.awt.event.ActionEvent;\r\nimport java.awt.event.ActionListener;\r\n \r\nimport com.bw.osgi.provider.able.HelloWorldService;\r\n \r\npublic class HelloWorldConsumer implements ActionListener {\r\n    private final HelloWorldService service;\r\n    private final Timer timer;\r\n \r\n    public HelloWorldConsumer(HelloWorldService service) {\r\n        super();\r\n \r\n        this.service = service;\r\n \r\n        timer = new Timer(1000, this);\r\n    }\r\n \r\n    public void startTimer(){\r\n        timer.start();\r\n    }\r\n \r\n    public void stopTimer() {\r\n        timer.stop();\r\n    }\r\n \r\n    @Override\r\n    public void actionPerformed(ActionEvent e) {\r\n        service.hello();\r\n    }\r\n}\r\n<\/pre>\n<p>At this time, there is no changes to do here. Instead of the injection with constructor we could have used an @Resource annotation, but this doesn\u2019t work in Spring 2.5.6 and Spring Dm (but works well with Spring 3.0).<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p>And now the activator :<\/p>\n<pre class=\"brush: java\">package com.bw.osgi.consumer;\r\n \r\nimport org.osgi.framework.BundleActivator;\r\nimport org.osgi.framework.BundleContext;\r\nimport org.osgi.framework.ServiceReference;\r\n \r\nimport com.bw.osgi.provider.able.HelloWorldService;\r\n \r\npublic class HelloWorldActivator implements BundleActivator {\r\n    private HelloWorldConsumer consumer;\r\n \r\n    @Override\r\n    public void start(BundleContext bundleContext) throws Exception {\r\n        ServiceReference reference = bundleContext.getServiceReference(HelloWorldService.class.getName());\r\n \r\n        consumer = new HelloWorldConsumer((HelloWorldService) bundleContext.getService(reference));\r\n        consumer.startTimer();\r\n    }\r\n \r\n    @Override\r\n    public void stop(BundleContext bundleContext) throws Exception {\r\n        consumer.stopTimer();\r\n    }\r\n}\r\n<\/pre>\n<p>The injection is not necessary anymore. We can keep the start of the timer here, but once again, we can use the features of the framework to start and stop the timer. So let\u2019s delete the activator and create an application context to create the consumer and start it automatically and put in the <i>META-INF\/spring folder<\/i> :<\/p>\n<pre class=\"brush: xml\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;beans xmlns=\"http:\/\/www.springframework.org\/schema\/beans\"\r\n       xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\r\n       xmlns:osgi=\"http:\/\/www.springframework.org\/schema\/osgi\"\r\n       xmlns:context=\"http:\/\/www.springframework.org\/schema\/context\"\r\n       xsi:schemaLocation=\"\r\n            http:\/\/www.springframework.org\/schema\/beans\r\n            http:\/\/www.springframework.org\/schema\/beans\/spring-beans-3.0.xsd\r\n            http:\/\/www.springframework.org\/schema\/osgi\r\n            http:\/\/www.springframework.org\/schema\/osgi\/spring-osgi.xsd\"&gt;\r\n \r\n    &lt;bean id=\"consumer\" class=\"com.bw.osgi.consumer.HelloWorldConsumer\" init-method=\"startTimer\" destroy-method=\"stopTimer\"\r\n          lazy-init=\"false\" &gt;\r\n        &lt;constructor-arg ref=\"eventService\"\/&gt;\r\n    &lt;\/bean&gt;\r\n \r\n    &lt;osgi:reference id=\"eventService\" interface=\"com.bw.osgi.provider.able.HelloWorldService\"\/&gt;\r\n&lt;\/beans&gt;\r\n<\/pre>\n<p>We used the init-method and destroy-method attributes to start and stop the time with the framework and we use the constructor-arg to inject to reference to the service. The reference to the service is obtained using osgi:reference field and using the interface as a key to the service.<\/p>\n<p>That\u2019s all we have to do with this bundle. A lot more simple than the first version isn\u2019t it ? And more than the simplification, you can see that the sources aren\u2019t depending of either OSGi or Spring Framework, this is plain Java and this is a great advantage.<\/p>\n<p>The Maven POMs are the same than in the first phase except that we can cut the dependency to osgi.<\/p>\n<p>The provider :<\/p>\n<pre class=\"brush: xml\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;project xmlns=\"http:\/\/maven.apache.org\/POM\/4.0.0\"\r\n         xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\r\n         xsi:schemaLocation=\"http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd\"&gt;\r\n    &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\r\n    &lt;groupId&gt;OSGiDmHelloWorldProvider&lt;\/groupId&gt;\r\n    &lt;artifactId&gt;OSGiDmHelloWorldProvider&lt;\/artifactId&gt;\r\n    &lt;version&gt;1.0&lt;\/version&gt;\r\n    &lt;packaging&gt;bundle&lt;\/packaging&gt;\r\n \r\n    &lt;build&gt;\r\n        &lt;plugins&gt;\r\n            &lt;plugin&gt;\r\n                &lt;groupId&gt;org.apache.maven.plugins&lt;\/groupId&gt;\r\n                &lt;artifactId&gt;maven-compiler-plugin&lt;\/artifactId&gt;\r\n                &lt;version&gt;2.0.2&lt;\/version&gt;\r\n                &lt;configuration&gt;\r\n                    &lt;source&gt;1.6&lt;\/source&gt;\r\n                    &lt;target&gt;1.6&lt;\/target&gt;\r\n                &lt;\/configuration&gt;\r\n            &lt;\/plugin&gt;\r\n \r\n            &lt;plugin&gt;\r\n                &lt;groupId&gt;org.apache.felix&lt;\/groupId&gt;\r\n                &lt;artifactId&gt;maven-bundle-plugin&lt;\/artifactId&gt;\r\n                &lt;extensions&gt;true&lt;\/extensions&gt;\r\n                &lt;configuration&gt;\r\n                    &lt;instructions&gt;\r\n                        &lt;Bundle-SymbolicName&gt;OSGiDmHelloWorldProvider&lt;\/Bundle-SymbolicName&gt;\r\n                        &lt;Export-Package&gt;com.bw.osgi.provider.able&lt;\/Export-Package&gt;\r\n                        &lt;Bundle-Vendor&gt;Baptiste Wicht&lt;\/Bundle-Vendor&gt;\r\n                    &lt;\/instructions&gt;\r\n                &lt;\/configuration&gt;\r\n            &lt;\/plugin&gt;\r\n        &lt;\/plugins&gt;\r\n    &lt;\/build&gt; \r\n&lt;\/project&gt;\r\n<\/pre>\n<p>The consumer :<\/p>\n<pre class=\"brush: xml\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;project xmlns=\"http:\/\/maven.apache.org\/POM\/4.0.0\"\r\n         xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\r\n         xsi:schemaLocation=\"http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd\"&gt;\r\n    &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\r\n    &lt;groupId&gt;OSGiDmHelloWorldConsumer&lt;\/groupId&gt;\r\n    &lt;artifactId&gt;OSGiDmHelloWorldConsumer&lt;\/artifactId&gt;\r\n    &lt;version&gt;1.0&lt;\/version&gt;\r\n    &lt;packaging&gt;bundle&lt;\/packaging&gt;\r\n \r\n    &lt;dependencies&gt;\r\n        &lt;dependency&gt;\r\n            &lt;groupId&gt;OSGiDmHelloWorldProvider&lt;\/groupId&gt;\r\n            &lt;artifactId&gt;OSGiDmHelloWorldProvider&lt;\/artifactId&gt;\r\n            &lt;version&gt;1.0&lt;\/version&gt;\r\n        &lt;\/dependency&gt;\r\n    &lt;\/dependencies&gt;\r\n \r\n    &lt;build&gt;\r\n        &lt;plugins&gt;\r\n            &lt;plugin&gt;\r\n                &lt;groupId&gt;org.apache.maven.plugins&lt;\/groupId&gt;\r\n                &lt;artifactId&gt;maven-compiler-plugin&lt;\/artifactId&gt;\r\n                &lt;version&gt;2.0.2&lt;\/version&gt;\r\n                &lt;configuration&gt;\r\n                    &lt;source&gt;1.6&lt;\/source&gt;\r\n                    &lt;target&gt;1.6&lt;\/target&gt;\r\n                &lt;\/configuration&gt;\r\n            &lt;\/plugin&gt;\r\n \r\n            &lt;plugin&gt;\r\n                &lt;groupId&gt;org.apache.felix&lt;\/groupId&gt;\r\n                &lt;artifactId&gt;maven-bundle-plugin&lt;\/artifactId&gt;\r\n                &lt;extensions&gt;true&lt;\/extensions&gt;\r\n                &lt;configuration&gt;\r\n                    &lt;instructions&gt;\r\n                        &lt;Bundle-SymbolicName&gt;OSGiDmHelloWorldConsumer&lt;\/Bundle-SymbolicName&gt;\r\n                        &lt;Bundle-Vendor&gt;Baptiste Wicht&lt;\/Bundle-Vendor&gt;\r\n                    &lt;\/instructions&gt;\r\n                &lt;\/configuration&gt;\r\n            &lt;\/plugin&gt;\r\n        &lt;\/plugins&gt;\r\n    &lt;\/build&gt;\r\n&lt;\/project&gt;\r\n<\/pre>\n<p>And we can build the two bundles using maven install. So let\u2019s test our stuff in Felix :<\/p>\n<pre class=\"brush: bash\">wichtounet@Linux-Desktop:~\/Desktop\/osgi\/felix$ java -jar bin\/felix.jar\r\n_______________\r\nWelcome to Apache Felix Gogo\r\n\r\ng! install file:..\/com.springsource.slf4j.org.apache.commons.logging-1.5.0.jar\r\nBundle ID: 5\r\ng! install file:..\/com.springsource.slf4j.log4j-1.5.0.jar\r\nBundle ID: 6\r\ng! install file:..\/com.springsource.slf4j.api-1.5.0.jar\r\nBundle ID: 7\r\ng! install file:..\/log4j.osgi-1.2.15-SNAPSHOT.jar\r\nBundle ID: 8\r\ng! install file:..\/com.springsource.net.sf.cglib-2.1.3.jar\r\nBundle ID: 9\r\ng! install file:..\/com.springsource.org.aopalliance-1.0.0.jar\r\nBundle ID: 10\r\ng! install file:..\/org.springframework.core-2.5.6.SEC01.jar\r\nBundle ID: 11\r\ng! install file:..\/org.springframework.context-2.5.6.SEC01.jar\r\nBundle ID: 12\r\ng! install file:..\/org.springframework.beans-2.5.6.SEC01.jar\r\nBundle ID: 13\r\ng! install file:..\/org.springframework.aop-2.5.6.SEC01.jar\r\nBundle ID: 14\r\ng! install file:..\/spring-osgi-extender-1.2.1.jar\r\nBundle ID: 15\r\ng! install file:..\/spring-osgi-core-1.2.1.jar\r\nBundle ID: 16\r\ng! install file:..\/spring-osgi-io-1.2.1.jar\r\nBundle ID: 17\r\ng! start 5 7 8 9 10 11 12 13 14 15 16 17\r\nlog4j:WARN No appenders could be found for logger (org.springframework.osgi.extender.internal.activator.ContextLoaderListener).\r\nlog4j:WARN Please initialize the log4j system properly.\r\ng! install file:..\/OSGiDmHelloWorldProvider-1.0.jar\r\nBundle ID: 18\r\ng! install file:..\/OSGiDmHelloWorldConsumer-1.0.jar\r\nBundle ID: 19\r\ng! start 18\r\ng! start 19\r\ng! Hello World !\r\nHello World !\r\nHello World !\r\nHello World !\r\nHello World !\r\nHello World !\r\nHello World !\r\nHello World !\r\nstop 19\r\ng! \r\n<\/pre>\n<p>As you can see, it works perfectly !<\/p>\n<p>In conclusion, Spring Dm really makes easier the development with OSGi. With Spring Dm you can also start bundles. It also allows you to make web bundles and to use easily the services of the OSGi compendium.<\/p>\n<p>Here are the sources of the two projects :<\/p>\n<ul style=\"text-align: left\">\n<li><a href=\"http:\/\/baptiste-wicht.appspot.com\/wp-content\/uploads\/2010\/07\/OSGiDmHelloWorldProvider.tar1.gz\">OSGiDmHelloWorldProvider Sources<\/a><\/li>\n<li><a href=\"http:\/\/baptiste-wicht.appspot.com\/wp-content\/uploads\/2010\/07\/OSGiDmHelloWorldConsumer.tar1.gz\">OSGiDmHelloWorldConsumer Sources<\/a><\/li>\n<\/ul>\n<p>Here are directly the two buildeds Jars :<\/p>\n<ul style=\"text-align: left\">\n<li><a href=\"http:\/\/baptiste-wicht.appspot.com\/wp-content\/uploads\/2010\/07\/OSGiDmHelloWorldProvider-1.0.jar\">OSGiDmHelloWorldProvider-1.0.jar<\/a><\/li>\n<li><a href=\"http:\/\/baptiste-wicht.appspot.com\/wp-content\/uploads\/2010\/07\/OSGiDmHelloWorldConsumer-1.0.jar\">OSGiDmHelloWorldConsumer-1.0.jar<\/a><\/li>\n<\/ul>\n<p>And here are the complete folder including Felix and Spring Dm : <a href=\"http:\/\/baptiste-wicht.appspot.com\/wp-content\/uploads\/2010\/07\/osgi-hello-world.tar.gz\">osgi-hello-world.tar.gz<\/a><\/p>\n<p><strong><i>Reference: <\/i><\/strong><a href=\"http:\/\/www.baptiste-wicht.com\/2010\/07\/osgi-spring-dynamic-modules-hello-world\/\">OSGI and Spring Dynamic Modules \u2013 Simple Hello World<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/p\/jcg.html\">JCG partner<\/a> <a href=\"http:\/\/baptiste-wicht.com\/about\/\">Baptiste Wicht<\/a> at <a href=\"http:\/\/www.baptiste-wicht.com\/\">@Blog(&#8220;Baptiste Wicht&#8221;)<\/a>.<\/p>\n<div style=\"margin: 0px\"><strong><i>Related Articles :<\/i><\/strong><\/div>\n<ul>\n<li><a href=\"http:\/\/www.javacodegeeks.com\/2011\/11\/osgi-simple-hello-world-with-services.html\">OSGi \u2013 Simple Hello World with services<\/a><\/li>\n<li><a href=\"http:\/\/www.javacodegeeks.com\/2011\/06\/osgi-using-maven-equinox.html\">OSGi Using Maven with Equinox<\/a><\/li>\n<li><a href=\"http:\/\/www.javacodegeeks.com\/2011\/09\/real-modular-web-applications-why-there.html\">Real modular web applications: Why there is no standard for developing them?<\/a><\/li>\n<li><a href=\"http:\/\/www.javacodegeeks.com\/2011\/10\/java-modularity-approaches-modules.html\">Java Modularity Approaches &#8211; Modules, modules, modules<\/a><\/li>\n<\/ul>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this pose st, we\u2019ll take the first implementation we made using OSGi and use Spring Dynamic Modules to improve the application. Spring Dynamic Modules (Spring Dm) makes the development of OSGi-based applications a lot more easier. With that, the deployment of services is a lot easier. You can inject services like any other Spring &hellip;<\/p>\n","protected":false},"author":86,"featured_media":211,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[190,315],"class_list":["post-709","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-osgi","tag-spring-dynamic-modules"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>OSGI and Spring Dynamic Modules \u2013 Simple Hello World - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"In this pose st, we\u2019ll take the first implementation we made using OSGi and use Spring Dynamic Modules to improve the application. Spring Dynamic Modules\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2011\/11\/osgi-and-spring-dynamic-modules-simple.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"OSGI and Spring Dynamic Modules \u2013 Simple Hello World - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"In this pose st, we\u2019ll take the first implementation we made using OSGi and use Spring Dynamic Modules to improve the application. Spring Dynamic Modules\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2011\/11\/osgi-and-spring-dynamic-modules-simple.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2011-11-04T19:41:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2012-10-21T20:43:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/osgi-alliance-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Baptiste Wicht\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@http:\/\/twitter.com\/wichtounet\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Baptiste Wicht\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/11\\\/osgi-and-spring-dynamic-modules-simple.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/11\\\/osgi-and-spring-dynamic-modules-simple.html\"},\"author\":{\"name\":\"Baptiste Wicht\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/3da1130a362719833b5b35b5594257c4\"},\"headline\":\"OSGI and Spring Dynamic Modules \u2013 Simple Hello World\",\"datePublished\":\"2011-11-04T19:41:00+00:00\",\"dateModified\":\"2012-10-21T20:43:24+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/11\\\/osgi-and-spring-dynamic-modules-simple.html\"},\"wordCount\":676,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/11\\\/osgi-and-spring-dynamic-modules-simple.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/osgi-alliance-logo.jpg\",\"keywords\":[\"OSGi\",\"Spring Dynamic Modules\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/11\\\/osgi-and-spring-dynamic-modules-simple.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/11\\\/osgi-and-spring-dynamic-modules-simple.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/11\\\/osgi-and-spring-dynamic-modules-simple.html\",\"name\":\"OSGI and Spring Dynamic Modules \u2013 Simple Hello World - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/11\\\/osgi-and-spring-dynamic-modules-simple.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/11\\\/osgi-and-spring-dynamic-modules-simple.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/osgi-alliance-logo.jpg\",\"datePublished\":\"2011-11-04T19:41:00+00:00\",\"dateModified\":\"2012-10-21T20:43:24+00:00\",\"description\":\"In this pose st, we\u2019ll take the first implementation we made using OSGi and use Spring Dynamic Modules to improve the application. Spring Dynamic Modules\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/11\\\/osgi-and-spring-dynamic-modules-simple.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/11\\\/osgi-and-spring-dynamic-modules-simple.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/11\\\/osgi-and-spring-dynamic-modules-simple.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/osgi-alliance-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/osgi-alliance-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/11\\\/osgi-and-spring-dynamic-modules-simple.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"OSGI and Spring Dynamic Modules \u2013 Simple Hello World\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/3da1130a362719833b5b35b5594257c4\",\"name\":\"Baptiste Wicht\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/14b127dfae5fef8d2e39cc55fd0984438f9f2db169294d315579886deadd0523?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/14b127dfae5fef8d2e39cc55fd0984438f9f2db169294d315579886deadd0523?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/14b127dfae5fef8d2e39cc55fd0984438f9f2db169294d315579886deadd0523?s=96&d=mm&r=g\",\"caption\":\"Baptiste Wicht\"},\"description\":\"Baptiste Wicht is a swiss computer science student. He's very interested in Java, C++, Assembly, Compiler Theory, ... He also is the developer of the EDDI programming language.\",\"sameAs\":[\"http:\\\/\\\/www.baptiste-wicht.com\\\/\",\"http:\\\/\\\/www.linkedin.com\\\/in\\\/baptistewicht\",\"https:\\\/\\\/x.com\\\/http:\\\/\\\/twitter.com\\\/wichtounet\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/Baptiste-Wicht\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"OSGI and Spring Dynamic Modules \u2013 Simple Hello World - Java Code Geeks","description":"In this pose st, we\u2019ll take the first implementation we made using OSGi and use Spring Dynamic Modules to improve the application. Spring Dynamic Modules","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2011\/11\/osgi-and-spring-dynamic-modules-simple.html","og_locale":"en_US","og_type":"article","og_title":"OSGI and Spring Dynamic Modules \u2013 Simple Hello World - Java Code Geeks","og_description":"In this pose st, we\u2019ll take the first implementation we made using OSGi and use Spring Dynamic Modules to improve the application. Spring Dynamic Modules","og_url":"https:\/\/www.javacodegeeks.com\/2011\/11\/osgi-and-spring-dynamic-modules-simple.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2011-11-04T19:41:00+00:00","article_modified_time":"2012-10-21T20:43:24+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/osgi-alliance-logo.jpg","type":"image\/jpeg"}],"author":"Baptiste Wicht","twitter_card":"summary_large_image","twitter_creator":"@http:\/\/twitter.com\/wichtounet","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Baptiste Wicht","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2011\/11\/osgi-and-spring-dynamic-modules-simple.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/11\/osgi-and-spring-dynamic-modules-simple.html"},"author":{"name":"Baptiste Wicht","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/3da1130a362719833b5b35b5594257c4"},"headline":"OSGI and Spring Dynamic Modules \u2013 Simple Hello World","datePublished":"2011-11-04T19:41:00+00:00","dateModified":"2012-10-21T20:43:24+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/11\/osgi-and-spring-dynamic-modules-simple.html"},"wordCount":676,"commentCount":1,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/11\/osgi-and-spring-dynamic-modules-simple.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/osgi-alliance-logo.jpg","keywords":["OSGi","Spring Dynamic Modules"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2011\/11\/osgi-and-spring-dynamic-modules-simple.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2011\/11\/osgi-and-spring-dynamic-modules-simple.html","url":"https:\/\/www.javacodegeeks.com\/2011\/11\/osgi-and-spring-dynamic-modules-simple.html","name":"OSGI and Spring Dynamic Modules \u2013 Simple Hello World - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/11\/osgi-and-spring-dynamic-modules-simple.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/11\/osgi-and-spring-dynamic-modules-simple.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/osgi-alliance-logo.jpg","datePublished":"2011-11-04T19:41:00+00:00","dateModified":"2012-10-21T20:43:24+00:00","description":"In this pose st, we\u2019ll take the first implementation we made using OSGi and use Spring Dynamic Modules to improve the application. Spring Dynamic Modules","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/11\/osgi-and-spring-dynamic-modules-simple.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2011\/11\/osgi-and-spring-dynamic-modules-simple.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2011\/11\/osgi-and-spring-dynamic-modules-simple.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/osgi-alliance-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/osgi-alliance-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2011\/11\/osgi-and-spring-dynamic-modules-simple.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"OSGI and Spring Dynamic Modules \u2013 Simple Hello World"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/3da1130a362719833b5b35b5594257c4","name":"Baptiste Wicht","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/14b127dfae5fef8d2e39cc55fd0984438f9f2db169294d315579886deadd0523?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/14b127dfae5fef8d2e39cc55fd0984438f9f2db169294d315579886deadd0523?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/14b127dfae5fef8d2e39cc55fd0984438f9f2db169294d315579886deadd0523?s=96&d=mm&r=g","caption":"Baptiste Wicht"},"description":"Baptiste Wicht is a swiss computer science student. He's very interested in Java, C++, Assembly, Compiler Theory, ... He also is the developer of the EDDI programming language.","sameAs":["http:\/\/www.baptiste-wicht.com\/","http:\/\/www.linkedin.com\/in\/baptistewicht","https:\/\/x.com\/http:\/\/twitter.com\/wichtounet"],"url":"https:\/\/www.javacodegeeks.com\/author\/Baptiste-Wicht"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/709","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/86"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=709"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/709\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/211"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=709"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=709"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=709"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}