{"id":61772,"date":"2016-11-14T16:00:16","date_gmt":"2016-11-14T14:00:16","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/?p=61772"},"modified":"2016-11-13T13:36:14","modified_gmt":"2016-11-13T11:36:14","slug":"create-jndi-resources-junit-testing-using-spring","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2016\/11\/create-jndi-resources-junit-testing-using-spring.html","title":{"rendered":"Create JNDI resources for JUnit testing using Spring"},"content":{"rendered":"<p>Until recently, I had static methods setting up my in memory database (HSQLDB). I called these methods in setUp\/tearDown of my JUnit tests. This felt always a bit unnatural to me as I use Spring and everything should run through it&#8217;s application context.<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/2016-04-22-jndi-junit.png\"><img decoding=\"async\" class=\"aligncenter wp-image-61773 size-large\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/2016-04-22-jndi-junit-1024x512.png\" alt=\"2016-04-22-jndi-junit\" width=\"620\" height=\"310\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/2016-04-22-jndi-junit.png 1024w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/2016-04-22-jndi-junit-300x150.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/2016-04-22-jndi-junit-768x384.png 768w\" sizes=\"(max-width: 620px) 100vw, 620px\" \/><\/a><\/p>\n<h2>Creating a simple JNDI bean<\/h2>\n<p>As I use JNDI in production, I had to created a JNDI resource for my application as well. A simple Spring Bean using Apache Commons DBCP does the trick:<\/p>\n<pre class=\"brush:java\">public class JndiBean {\r\n\r\n    public JndiBean() {\r\n        try {\r\n            DriverAdapterCPDS cpds = new DriverAdapterCPDS();\r\n            cpds.setDriver(\"org.hsqldb.jdbc.JDBCDriver\");\r\n            cpds.setUrl(\"jdbc:hsqldb:mem:testdb\");\r\n            cpds.setUser(\"SA\");\r\n            cpds.setPassword(\"\");\r\n\r\n            SharedPoolDataSource dataSource = new SharedPoolDataSource();\r\n            dataSource.setConnectionPoolDataSource(cpds);\r\n            dataSource.setMaxActive(10);\r\n            dataSource.setMaxWait(50);\r\n\r\n            SimpleNamingContextBuilder builder = new SimpleNamingContextBuilder();\r\n            builder.bind(\"java:comp\/env\/jdbc\/timeandbill\", dataSource);\r\n            builder.activate();\r\n        } catch (NamingException | ClassNotFoundException ex) {\r\n            ex.printStackTrace();\r\n        }\r\n    }\r\n}<\/pre>\n<p>You should not use this basic configuration without thinking twice, but it works well for unit testing.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p>First, I created a driver adapter, containing whatever I need for connecting to my database. It could be MySQL, Postgres or whatever else you prefer.<\/p>\n<p>Then I create a SharedPoolDatasource. It is not really necessary to keep up a lot of connections, as tests usually run sequential. Even if not, the Spring context usually will be created at least per test class. It is unlikely you get out a benefit of pooling here, but I wanted to stick to what production servers usually do.<\/p>\n<p>The SimpleNamingContextBuilder is what eventually bind the perviously created data source to the JNDI context. As you see, it&#8217;s a straightforward thing todo: just bind it, then activate and you are done.<\/p>\n<h2>Adding the JNDI bean to the context<\/h2>\n<p>The next step is to add this to a second applicationContext.xml, which is loaded by JUnit tests only. I resides in my Unit-tests folder and contains:<\/p>\n<pre class=\"brush:xml\">&lt;bean id=\"jndi\" class=\"de.grobmeier.tab.webapp.JndiBean\" lazy-init=\"false\" \/&gt;<\/pre>\n<p>These annotations on my tests make sure I load all applicationContext files:<\/p>\n<pre class=\"brush:java\">@RunWith(SpringJUnit4ClassRunner.class)\r\n@ContextConfiguration(locations={\"classpath*:applicationContext.xml\"})\r\npublic class TimeConverterTest {<\/pre>\n<p>My production applicationContext contains this:<\/p>\n<pre class=\"brush:xml\">&lt;bean id=\"dataSource\" class=\"org.springframework.jndi.JndiObjectFactoryBean\"&gt;\r\n    &lt;property name=\"jndiName\" value=\"java:comp\/env\/jdbc\/timeandbill\"\/&gt;\r\n    &lt;property name=\"resourceRef\" value=\"true\" \/&gt;\r\n&lt;\/bean&gt;\r\n\r\n&lt;bean id=\"sqlSessionFactory\" class=\"org.mybatis.spring.SqlSessionFactoryBean\"&gt;\r\n    &lt;property name=\"dataSource\" ref=\"dataSource\" \/&gt;\r\n&lt;\/bean&gt;<\/pre>\n<p>As there is no Java EE server running at JUnit level. Instead the JNDI connection was created manually. In production, the JUnits applicationContext is not loaded and the Java EE container provides the JNDI resource.<\/p>\n<blockquote>\n<p>Side note: I found Mybatis relies on Springs autowire &#8220;byType&#8221; feature.<\/p>\n<\/blockquote>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td><span class=\"reference\">Reference: <\/span><\/td>\n<td><a href=\"https:\/\/www.grobmeier.de\/junit-with-spring-and-jndi-22042016.html\">Create JNDI resources for JUnit testing using Spring<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/jcg\">JCG partner<\/a> Christian Grobmeier at the <a href=\"http:\/\/www.grobmeier.de\/\">PHP und Java Entwickler<\/a> blog.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Until recently, I had static methods setting up my in memory database (HSQLDB). I called these methods in setUp\/tearDown of my JUnit tests. This felt always a bit unnatural to me as I use Spring and everything should run through it&#8217;s application context. Creating a simple JNDI bean As I use JNDI in production, I &hellip;<\/p>\n","protected":false},"author":299,"featured_media":176,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[44,274,30],"class_list":["post-61772","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-jndi","tag-junit","tag-spring"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Create JNDI resources for JUnit testing using Spring - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Until recently, I had static methods setting up my in memory database (HSQLDB). I called these methods in setUp\/tearDown of my JUnit tests. This felt\" \/>\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\/2016\/11\/create-jndi-resources-junit-testing-using-spring.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Create JNDI resources for JUnit testing using Spring - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Until recently, I had static methods setting up my in memory database (HSQLDB). I called these methods in setUp\/tearDown of my JUnit tests. This felt\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2016\/11\/create-jndi-resources-junit-testing-using-spring.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=\"2016-11-14T14:00:16+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/junit-logo-e1426444701180.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=\"Christian Grobmeier\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@http:\/\/twitter.com\/grobmeier\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Christian Grobmeier\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/11\\\/create-jndi-resources-junit-testing-using-spring.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/11\\\/create-jndi-resources-junit-testing-using-spring.html\"},\"author\":{\"name\":\"Christian Grobmeier\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/e5d53c4a1491df76f8d8ac4b01df8ba3\"},\"headline\":\"Create JNDI resources for JUnit testing using Spring\",\"datePublished\":\"2016-11-14T14:00:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/11\\\/create-jndi-resources-junit-testing-using-spring.html\"},\"wordCount\":340,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/11\\\/create-jndi-resources-junit-testing-using-spring.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/junit-logo-e1426444701180.jpg\",\"keywords\":[\"JNDI\",\"JUnit\",\"Spring\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/11\\\/create-jndi-resources-junit-testing-using-spring.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/11\\\/create-jndi-resources-junit-testing-using-spring.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/11\\\/create-jndi-resources-junit-testing-using-spring.html\",\"name\":\"Create JNDI resources for JUnit testing using Spring - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/11\\\/create-jndi-resources-junit-testing-using-spring.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/11\\\/create-jndi-resources-junit-testing-using-spring.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/junit-logo-e1426444701180.jpg\",\"datePublished\":\"2016-11-14T14:00:16+00:00\",\"description\":\"Until recently, I had static methods setting up my in memory database (HSQLDB). I called these methods in setUp\\\/tearDown of my JUnit tests. This felt\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/11\\\/create-jndi-resources-junit-testing-using-spring.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/11\\\/create-jndi-resources-junit-testing-using-spring.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/11\\\/create-jndi-resources-junit-testing-using-spring.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/junit-logo-e1426444701180.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/junit-logo-e1426444701180.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/11\\\/create-jndi-resources-junit-testing-using-spring.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\":\"Create JNDI resources for JUnit testing using Spring\"}]},{\"@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\\\/e5d53c4a1491df76f8d8ac4b01df8ba3\",\"name\":\"Christian Grobmeier\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5cc79122958826728ee08076c263ce8f89ccc65f2e8537ab3fb5a9c75b4121c2?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5cc79122958826728ee08076c263ce8f89ccc65f2e8537ab3fb5a9c75b4121c2?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5cc79122958826728ee08076c263ce8f89ccc65f2e8537ab3fb5a9c75b4121c2?s=96&d=mm&r=g\",\"caption\":\"Christian Grobmeier\"},\"description\":\"Christian is a passionated software developer, architect and trainer. He is a member and VP of the Apache Software Foundation, working on projects like Struts, log4j and others. He founded Time &amp; Bill and constantly tries out new ideas.\",\"sameAs\":[\"http:\\\/\\\/www.grobmeier.de\\\/\",\"http:\\\/\\\/www.linkedin.com\\\/profile\\\/view?id=84345075&trk=tab_pro\",\"https:\\\/\\\/x.com\\\/http:\\\/\\\/twitter.com\\\/grobmeier\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/Christian-Grobmeier\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Create JNDI resources for JUnit testing using Spring - Java Code Geeks","description":"Until recently, I had static methods setting up my in memory database (HSQLDB). I called these methods in setUp\/tearDown of my JUnit tests. This felt","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\/2016\/11\/create-jndi-resources-junit-testing-using-spring.html","og_locale":"en_US","og_type":"article","og_title":"Create JNDI resources for JUnit testing using Spring - Java Code Geeks","og_description":"Until recently, I had static methods setting up my in memory database (HSQLDB). I called these methods in setUp\/tearDown of my JUnit tests. This felt","og_url":"https:\/\/www.javacodegeeks.com\/2016\/11\/create-jndi-resources-junit-testing-using-spring.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2016-11-14T14:00:16+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/junit-logo-e1426444701180.jpg","type":"image\/jpeg"}],"author":"Christian Grobmeier","twitter_card":"summary_large_image","twitter_creator":"@http:\/\/twitter.com\/grobmeier","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Christian Grobmeier","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2016\/11\/create-jndi-resources-junit-testing-using-spring.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2016\/11\/create-jndi-resources-junit-testing-using-spring.html"},"author":{"name":"Christian Grobmeier","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/e5d53c4a1491df76f8d8ac4b01df8ba3"},"headline":"Create JNDI resources for JUnit testing using Spring","datePublished":"2016-11-14T14:00:16+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2016\/11\/create-jndi-resources-junit-testing-using-spring.html"},"wordCount":340,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2016\/11\/create-jndi-resources-junit-testing-using-spring.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/junit-logo-e1426444701180.jpg","keywords":["JNDI","JUnit","Spring"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2016\/11\/create-jndi-resources-junit-testing-using-spring.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2016\/11\/create-jndi-resources-junit-testing-using-spring.html","url":"https:\/\/www.javacodegeeks.com\/2016\/11\/create-jndi-resources-junit-testing-using-spring.html","name":"Create JNDI resources for JUnit testing using Spring - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2016\/11\/create-jndi-resources-junit-testing-using-spring.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2016\/11\/create-jndi-resources-junit-testing-using-spring.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/junit-logo-e1426444701180.jpg","datePublished":"2016-11-14T14:00:16+00:00","description":"Until recently, I had static methods setting up my in memory database (HSQLDB). I called these methods in setUp\/tearDown of my JUnit tests. This felt","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2016\/11\/create-jndi-resources-junit-testing-using-spring.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2016\/11\/create-jndi-resources-junit-testing-using-spring.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2016\/11\/create-jndi-resources-junit-testing-using-spring.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/junit-logo-e1426444701180.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/junit-logo-e1426444701180.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2016\/11\/create-jndi-resources-junit-testing-using-spring.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":"Create JNDI resources for JUnit testing using Spring"}]},{"@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\/e5d53c4a1491df76f8d8ac4b01df8ba3","name":"Christian Grobmeier","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/5cc79122958826728ee08076c263ce8f89ccc65f2e8537ab3fb5a9c75b4121c2?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5cc79122958826728ee08076c263ce8f89ccc65f2e8537ab3fb5a9c75b4121c2?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5cc79122958826728ee08076c263ce8f89ccc65f2e8537ab3fb5a9c75b4121c2?s=96&d=mm&r=g","caption":"Christian Grobmeier"},"description":"Christian is a passionated software developer, architect and trainer. He is a member and VP of the Apache Software Foundation, working on projects like Struts, log4j and others. He founded Time &amp; Bill and constantly tries out new ideas.","sameAs":["http:\/\/www.grobmeier.de\/","http:\/\/www.linkedin.com\/profile\/view?id=84345075&trk=tab_pro","https:\/\/x.com\/http:\/\/twitter.com\/grobmeier"],"url":"https:\/\/www.javacodegeeks.com\/author\/Christian-Grobmeier"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/61772","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\/299"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=61772"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/61772\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/176"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=61772"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=61772"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=61772"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}