title: Spring Boot , JNDI lookup database with application.properties
body: <p>I create a REST service with Jersey , Spring Boot and Spring Data.</p>
  
  <p>My setup is Java 1.8 , Maven 3.3.9 , Spring Framework 4.3.0.RELEASE , Jersey 2.23.1 , Spring Boot 1.3.6.RELEASE , javax.ws.rs-api 2.0.1 ,
  Hibernate 5.1.0.FINAL</p>
  
  <p>I try to build a DataSource via defining it in <code>context.xml</code> and referencing this in <code>application.properties</code>. See method <code>permDbJpaDataSource()</code>.
  But it seems that the entry <code>spring.datasource.jndi-name=jdbc/permDb</code> is ignored. A bean named <code>permDbJpaDataSourceFAIL</code> is created, but
  all the properties are null (database URL, DB user etc...). I can see that the file <code>application.properties</code> is evaluated, because of
  <code>spring.main.banner-mode=off</code> .</p>
  
  <p>The method <code>jndiDataSource()</code> works fine, and I can build my application this way. But I would like to know if I'm doing something wrong
  or if it's a bug.</p>
  
  <p>These are my sources: </p>
  
  <pre><code>├───java
  │   └───com
  │       └───pkg
  │           └───permDb
  │               └───service
  │                   │   PermDbServiceApplication.java
  │                   │
  │                   ├───services
  │                   │       PermDbOwsService.java
  │                   │
  │                   └───springBoot
  │                           PermDbJerseyConfig.java
  │                           PermDbServiceSpringBoot.java
  │
  ├───resources
  │   │   application.properties
  │   │   log4j2.xml
  │   │
  │   └───META-INF
  │           context.xml
  │
  └───webapp
  </code></pre>
  
  <p><strong>PermDbServiceApplication.java</strong>
  </p>
  
  <pre><code>package com.pkg.permDb.service;
  
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  import org.springframework.boot.builder.SpringApplicationBuilder;
  import org.springframework.boot.context.web.SpringBootServletInitializer;
  
  @SpringBootApplication
  public class PermDbServiceApplication extends SpringBootServletInitializer
  {
      //private static Logger logger = LogManager.getLogger(PermDbServiceApplication.class.getName());
  
      @Override
      protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
      {
          return application.sources(PermDbServiceApplication.class);
      }
  
      public static void main(String[] args)
      {
          SpringApplication.run(PermDbServiceApplication.class, args);
      }
  
  }
  </code></pre>
  
  <p><strong>PermDbServiceSpringBoot.java</strong>
  </p>
  
  <pre><code>package com.pkg.permDb.service.springBoot;
  
  import java.io.IOException;
  import java.util.Hashtable;
  import java.util.Map;
  import javax.naming.NamingException;
  import javax.persistence.SharedCacheMode;
  import javax.persistence.ValidationMode;
  import javax.sql.DataSource;
  
  import org.apache.logging.log4j.LogManager;
  import org.apache.logging.log4j.Logger;
  import org.springframework.context.annotation.*;
  import org.springframework.jndi.JndiObjectFactoryBean;
  import org.springframework.orm.jpa.JpaTransactionManager;
  import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
  import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
  import org.springframework.transaction.PlatformTransactionManager;
  import org.springframework.transaction.annotation.EnableTransactionManagement;
  
  @Configuration
  @EnableTransactionManagement(mode = AdviceMode.PROXY, proxyTargetClass = false)
  @ComponentScan(basePackages = "com.pkg.permDb.repositories")
  public class PermDbServiceSpringBoot
  {
      private static Logger logger = LogManager.getLogger(PermDbServiceSpringBoot.class.getName());
  
      @Bean(name = "permDbEntityManager")
      public LocalContainerEntityManagerFactoryBean permDbEntityManagerFactoryBean() throws
              IOException
      {
          //Properties dmProps = dmProperties();
          Map&lt;String, Object&gt; propsMap = new Hashtable&lt;&gt;();
  
          logger.debug("erzeuge Bean {} ...", LocalContainerEntityManagerFactoryBean.class.getName());
          logger.debug("DataSource: {}", jndiDataSource());
          //propsMap.put("javax.persistence.schema-generation.database.action",
          //        dmProps.getProperty("dm.hibernateDbSchemaGeneration"));
  
          HibernateJpaVendorAdapter hibAdapter = new HibernateJpaVendorAdapter();
          //hibAdapter.setDatabasePlatform(dmProps.getProperty("dm.hibernateDbDialect"));
          hibAdapter.setDatabasePlatform("org.hibernate.dialect.PostgreSQL9Dialect");
  
          LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean();
          factoryBean.setJpaVendorAdapter(hibAdapter);
          factoryBean.setDataSource(jndiDataSource());
          //factoryBean.setPackagesToScan(dmProps.getProperty("dm.userDbModel"));
          factoryBean.setPackagesToScan("com.pkg.permDb.entities");
          factoryBean.setSharedCacheMode(SharedCacheMode.ENABLE_SELECTIVE);
          factoryBean.setValidationMode(ValidationMode.NONE);
          factoryBean.setPersistenceUnitName("PermDb");
  
          factoryBean.setJpaPropertyMap(propsMap);
  
          logger.debug("Bean erzeugt: {}", factoryBean);
          return factoryBean;
      }
  
      @Bean(name = "permDbJpaDataSource")
      public DataSource permDbJpaDataSource() throws DataSourceLookupFailureException, IOException
      {
      /* ##############################
         when these lines are executed, the entry spring.datasource.jndi-name
         from application.properties is not evaluated
         ############################## */
  
          logger.debug("erzeuge Bean {} ...", DataSource.class.getName());
          JndiDataSourceLookup lookup = new JndiDataSourceLookup();
          String dataSourceName = "java:comp/env/jdbc/permDb";
          DataSource dataSource = lookup.getDataSource(dataSourceName);
  
          logger.debug("Bean erzeugt: {}", dataSource);
          return dataSource;
      }
  
      @Bean(name ="permDbJpaDataSourceFAIL")
      public DataSource jndiDataSource()
      {
          JndiObjectFactoryBean bean = new JndiObjectFactoryBean();
          bean.setJndiName("java:comp/env/jdbc/permDb");
          bean.setProxyInterface(DataSource.class);
          bean.setLookupOnStartup(false);
          try
          {
              bean.afterPropertiesSet();
          }
          catch (NamingException e)
          {
              logger.error("FEHLER: ", e);
          }
          return (DataSource) bean.getObject();
      }
  
      @Bean(name = "permDbTransactionManager")
      //@Bean
      public PlatformTransactionManager transactionManager() throws IOException
      {
          return new JpaTransactionManager(permDbEntityManagerFactoryBean().getObject());
      }
  
  }
  </code></pre>
  
  <p><strong>PermDbJerseyConfig.java</strong>
  </p>
  
  <pre><code>package com.pkg.permDb.service.springBoot;
  
  import org.apache.logging.log4j.LogManager;
  import org.apache.logging.log4j.Logger;
  import org.glassfish.jersey.server.ResourceConfig;
  import org.springframework.stereotype.Component;
  
  import com.pkg.permDb.service.services.PermDbOwsService;
  
  @Component
  public class PermDbJerseyConfig extends ResourceConfig
  {
      private static Logger logger = LogManager.getLogger(PermDbJerseyConfig.class.getName());
  
      public PermDbJerseyConfig()
      {
          logger.debug("register services");
          register(PermDbOwsService.class);
      }
  }
  </code></pre>
  
  <p><strong>application.properties</strong></p>
  
  <pre><code>spring.datasource.jndi-name=jdbc/permDb
  spring.datasource.driver-class-name=org.postgresql.Driver
  spring.main.banner-mode=off
  #spring.jmx.enabled=false
  </code></pre>
  
  <p><strong>context.xml</strong>
  </p>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
  &lt;Context&gt;
      &lt;Resource name="jdbc/permDb" auth="Container"
                type="javax.sql.DataSource" driverClassName="org.postgresql.Driver"
                url="jdbc:postgresql://my.server.de:5432/oaktree"
                username="uhtred" password="password" maxTotal="50" maxIdle="10"
                maxWaitMillis="-1"/&gt;
  
  &lt;/Context&gt;
  </code></pre>
  
  <p><strong>pom.xml for module permDbService</strong>, parent see below
  </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;parent&gt;
          &lt;artifactId&gt;permDb&lt;/artifactId&gt;
          &lt;groupId&gt;com.permDb&lt;/groupId&gt;
          &lt;version&gt;0.2.2-SNAPSHOT&lt;/version&gt;
      &lt;/parent&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;artifactId&gt;permDbService&lt;/artifactId&gt;
      &lt;version&gt;0.1.2-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
  
      &lt;properties&gt;
          &lt;jersey.version&gt;2.23.1&lt;/jersey.version&gt;
      &lt;/properties&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
      &lt;dependencyManagement&gt;
          &lt;dependencies&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.glassfish.jersey&lt;/groupId&gt;
                  &lt;artifactId&gt;jersey-bom&lt;/artifactId&gt;
                  &lt;version&gt;${jersey.version}&lt;/version&gt;
                  &lt;type&gt;pom&lt;/type&gt;
                  &lt;scope&gt;import&lt;/scope&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;!-- Import dependency management from Spring Boot --&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-dependencies&lt;/artifactId&gt;
                  &lt;version&gt;1.3.6.RELEASE&lt;/version&gt;
                  &lt;type&gt;pom&lt;/type&gt;
                  &lt;scope&gt;import&lt;/scope&gt;
              &lt;/dependency&gt;
          &lt;/dependencies&gt;
      &lt;/dependencyManagement&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.permDb&lt;/groupId&gt;
              &lt;artifactId&gt;permDbRepositories&lt;/artifactId&gt;
              &lt;version&gt;0.1.0-SNAPSHOT&lt;/version&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
                      &lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.ws.rs&lt;/groupId&gt;
              &lt;artifactId&gt;javax.ws.rs-api&lt;/artifactId&gt;
              &lt;version&gt;2.0.1&lt;/version&gt;
              &lt;scope&gt;compile&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
              &lt;version&gt;3.1.0&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-jersey&lt;/artifactId&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                      &lt;artifactId&gt;spring-boot-starter-tomcat&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.containers&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-container-servlet-core&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.postgresql&lt;/groupId&gt;
              &lt;artifactId&gt;postgresql&lt;/artifactId&gt;
              &lt;!--&lt;version&gt;9.4.1208&lt;/version&gt;--&gt;
          &lt;/dependency&gt;
  
          &lt;!-- ###################   LOGGING   ####################--&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
              &lt;artifactId&gt;log4j-api&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
              &lt;artifactId&gt;log4j-core&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;!--
                  &lt;dependency&gt;
                      &amp;lt;!&amp;ndash; dies wird benötigt, damit das Hibernate-Logging über log4j2 konfigurierbar ist&amp;ndash;&amp;gt;
                      &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
                      &lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
                  &lt;/dependency&gt;
          --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.logging.log4j.adapters&lt;/groupId&gt;
              &lt;artifactId&gt;log4j-1.2-api&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
      &lt;/dependencies&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p><strong>parent pom.xml</strong>
  </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;com.permDb&lt;/groupId&gt;
      &lt;artifactId&gt;permDb&lt;/artifactId&gt;
      &lt;packaging&gt;pom&lt;/packaging&gt;
      &lt;version&gt;0.2.2-SNAPSHOT&lt;/version&gt;
  
      &lt;parent&gt;
          &lt;groupId&gt;com&lt;/groupId&gt;
          &lt;artifactId&gt;mavenToolParent&lt;/artifactId&gt;
          &lt;version&gt;1.0.0&lt;/version&gt;
      &lt;/parent&gt;
  
      &lt;modules&gt;
          &lt;module&gt;permDbData&lt;/module&gt;
          &lt;module&gt;permDbService&lt;/module&gt;
          &lt;module&gt;permDbRepositories&lt;/module&gt;
      &lt;/modules&gt;
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;!-- zum timestamp siehe http://rterp.wordpress.com/2012/03/16/stamping-version-number-and-build-time-in-properties-file-with-maven/ --&gt;
          &lt;build.timestamp&gt;${maven.build.timestamp}&lt;/build.timestamp&gt;
          &lt;maven.build.timestamp.format&gt;dd.MM.yyyy HH:mm&lt;/maven.build.timestamp.format&gt;
          &lt;log4j.version&gt;2.6.1&lt;/log4j.version&gt;
          &lt;hibernate.version&gt;5.1.0.Final&lt;/hibernate.version&gt;
          &lt;spring.version&gt;4.3.0.RELEASE&lt;/spring.version&gt;
      &lt;/properties&gt;
  
      &lt;profiles&gt;
          &lt;profile&gt;
              &lt;id&gt;permDb-local&lt;/id&gt;
              &lt;activation&gt;
                  &lt;activeByDefault&gt;true&lt;/activeByDefault&gt;
              &lt;/activation&gt;
              &lt;properties&gt;
              &lt;/properties&gt;
          &lt;/profile&gt;
          &lt;profile&gt;
              &lt;id&gt;permDb-ref&lt;/id&gt;
              &lt;activation&gt;
                  &lt;activeByDefault&gt;false&lt;/activeByDefault&gt;
              &lt;/activation&gt;
              &lt;properties&gt;
              &lt;/properties&gt;
          &lt;/profile&gt;
      &lt;/profiles&gt;
  
      &lt;build&gt;
          &lt;testResources&gt;
              &lt;testResource&gt;
                  &lt;directory&gt;src/test/resources&lt;/directory&gt;
                  &lt;filtering&gt;true&lt;/filtering&gt;
              &lt;/testResource&gt;
          &lt;/testResources&gt;
          &lt;resources&gt;
              &lt;resource&gt;
                  &lt;directory&gt;src/main/resources&lt;/directory&gt;
                  &lt;filtering&gt;true&lt;/filtering&gt;
                  &lt;excludes&gt;
                      &lt;exclude&gt;META-INF/context.xml&lt;/exclude&gt;
                  &lt;/excludes&gt;
              &lt;/resource&gt;
          &lt;/resources&gt;
  
          &lt;pluginManagement&gt;
              &lt;plugins&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                      &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
                      &lt;version&gt;2.5&lt;/version&gt;
                      &lt;configuration&gt;
                          &lt;failOnMissingWebXml&gt;false&lt;/failOnMissingWebXml&gt;
                          &lt;!--&lt;filteringDeploymentDescriptors&gt;true&lt;/filteringDeploymentDescriptors&gt;--&gt;
                          &lt;webResources&gt;
                              &lt;resource&gt;
                                  &lt;directory&gt;src/main/webapp&lt;/directory&gt;
                                  &lt;includes&gt;
                                      &lt;include&gt;**/*.html&lt;/include&gt;
                                  &lt;/includes&gt;
                                  &lt;filtering&gt;true&lt;/filtering&gt;
                              &lt;/resource&gt;
                              &lt;resource&gt;
                                  &lt;directory&gt;src/main/resources/META-INF&lt;/directory&gt;
                                  &lt;targetPath&gt;/META-INF&lt;/targetPath&gt;
                                  &lt;includes&gt;
                                      &lt;include&gt;context.xml&lt;/include&gt;
                                  &lt;/includes&gt;
                                  &lt;filtering&gt;true&lt;/filtering&gt;
                              &lt;/resource&gt;
                          &lt;/webResources&gt;
                      &lt;/configuration&gt;
                  &lt;/plugin&gt;
              &lt;/plugins&gt;
          &lt;/pluginManagement&gt;
  
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.1&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.8&lt;/source&gt;
                      &lt;target&gt;1.8&lt;/target&gt;
                      &lt;compilerArgument&gt;-proc:none&lt;/compilerArgument&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
  
              &lt;plugin&gt;
                  &lt;inherited&gt;true&lt;/inherited&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-enforcer-plugin&lt;/artifactId&gt;
                  &lt;version&gt;1.3&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;enforce-maven-3&lt;/id&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;enforce&lt;/goal&gt;
                          &lt;/goals&gt;
                          &lt;configuration&gt;
                              &lt;rules&gt;
                                  &lt;requireMavenVersion&gt;
                                      &lt;version&gt;3.3.9&lt;/version&gt;
                                  &lt;/requireMavenVersion&gt;
                              &lt;/rules&gt;
                              &lt;fail&gt;true&lt;/fail&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
      &lt;dependencyManagement&gt;
          &lt;dependencies&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
                  &lt;artifactId&gt;log4j-api&lt;/artifactId&gt;
                  &lt;version&gt;${log4j.version}&lt;/version&gt;
                  &lt;scope&gt;compile&lt;/scope&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
                  &lt;artifactId&gt;log4j-core&lt;/artifactId&gt;
                  &lt;version&gt;${log4j.version}&lt;/version&gt;
                  &lt;scope&gt;runtime&lt;/scope&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.apache.logging.log4j.adapters&lt;/groupId&gt;
                  &lt;artifactId&gt;log4j-1.2-api&lt;/artifactId&gt;
                  &lt;version&gt;LATEST&lt;/version&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;!-- dies wird benötigt, damit das Hibernate-Logging über log4j2 konfigurierbar ist--&gt;
                  &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
                  &lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
                  &lt;version&gt;1.7.21&lt;/version&gt;
                  &lt;exclusions&gt;
                      &lt;exclusion&gt;
                          &lt;groupId&gt;log4j&lt;/groupId&gt;
                          &lt;artifactId&gt;log4j&lt;/artifactId&gt;
                      &lt;/exclusion&gt;
                  &lt;/exclusions&gt;
              &lt;/dependency&gt;
  
              &lt;dependency&gt;
                  &lt;groupId&gt;org.apache.commons&lt;/groupId&gt;
                  &lt;artifactId&gt;commons-lang3&lt;/artifactId&gt;
                  &lt;version&gt;3.4&lt;/version&gt;
              &lt;/dependency&gt;
  
              &lt;dependency&gt;
                  &lt;groupId&gt;org.springframework&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-framework-bom&lt;/artifactId&gt;
                  &lt;version&gt;${spring.version}&lt;/version&gt;
                  &lt;type&gt;pom&lt;/type&gt;
                  &lt;scope&gt;import&lt;/scope&gt;
              &lt;/dependency&gt;
  
              &lt;dependency&gt;
                  &lt;groupId&gt;org.postgresql&lt;/groupId&gt;
                  &lt;artifactId&gt;postgresql&lt;/artifactId&gt;
                  &lt;version&gt;9.4.1208&lt;/version&gt;
                  &lt;scope&gt;provided&lt;/scope&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;com.fasterxml.uuid&lt;/groupId&gt;
                  &lt;artifactId&gt;java-uuid-generator&lt;/artifactId&gt;
                  &lt;version&gt;3.1.4&lt;/version&gt;
              &lt;/dependency&gt;
  
              &lt;dependency&gt;
                  &lt;groupId&gt;com.ows&lt;/groupId&gt;
                  &lt;artifactId&gt;owsMisc&lt;/artifactId&gt;
                  &lt;version&gt;1.0.0&lt;/version&gt;
              &lt;/dependency&gt;
  
              &lt;!-- #################   TEST   ################# --&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;junit&lt;/groupId&gt;
                  &lt;artifactId&gt;junit&lt;/artifactId&gt;
                  &lt;version&gt;4.12&lt;/version&gt;
                  &lt;scope&gt;test&lt;/scope&gt;
              &lt;/dependency&gt;
          &lt;/dependencies&gt;
      &lt;/dependencyManagement&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p><strong>UPDTAE</strong></p>
  
  <p>This is the output when I start the applcation:</p>
  
  <pre><code>2016-07-28 11:31:03.802  INFO 5636 --- [on(3)-127.0.0.1] d.lgn.permDb.service.PermDbServiceApplication  : Starting PermDbServiceApplication on GLL-H3-W7P139 with PID 5636 (D:\catalina-base-idea\webapps\permDb\WEB-INF\classes\com\pkg\permDb\service\PermDbServiceApplication.class started by ulrich.knaack in D:\Programme\apache-tomcat-8.0.15\bin)
  2016-07-28 11:31:03.818  INFO 5636 --- [on(3)-127.0.0.1] d.lgn.permDb.service.PermDbServiceApplication  : No active profile set, falling back to default profiles: default
  2016-07-28 11:31:03.880  INFO 5636 --- [on(3)-127.0.0.1] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@410bf06: startup date [Thu Jul 28 11:31:03 CEST 2016]; root of context hierarchy
  2016-07-28 11:31:05.175  INFO 5636 --- [on(3)-127.0.0.1] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
  2016-07-28 11:31:05.284  INFO 5636 --- [on(3)-127.0.0.1] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$fbaaf65b] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
  2016-07-28 11:31:05.331  INFO 5636 --- [on(3)-127.0.0.1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1451 ms
  11:31:05.627 [RMI TCP Connection(3)-127.0.0.1] DEBUG PermDbJerseyConfig - register services
  2016-07-28 11:31:05.830  INFO 5636 --- [on(3)-127.0.0.1] b.a.w.TomcatWebSocketContainerCustomizer : NonEmbeddedServletContainerFactory detected. Websockets support should be native so this normally is not a problem.
  2016-07-28 11:31:05.861  INFO 5636 --- [on(3)-127.0.0.1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'errorPageFilter' to: [/*]
  2016-07-28 11:31:05.861  INFO 5636 --- [on(3)-127.0.0.1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'characterEncodingFilter' to: [/*]
  2016-07-28 11:31:05.861  INFO 5636 --- [on(3)-127.0.0.1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'requestContextFilter' to: [/*]
  2016-07-28 11:31:05.861  INFO 5636 --- [on(3)-127.0.0.1] o.s.b.c.e.ServletRegistrationBean        : Mapping servlet: 'com.pkg.permDb.service.springBoot.PermDbJerseyConfig' to [/*]
  11:31:05.877 [RMI TCP Connection(3)-127.0.0.1] DEBUG PermDbServiceSpringBoot - erzeuge Bean org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean ...
  11:31:05.877 [RMI TCP Connection(3)-127.0.0.1] DEBUG PermDbServiceSpringBoot - erzeuge Bean javax.sql.DataSource ...
  11:31:05.877 [RMI TCP Connection(3)-127.0.0.1] DEBUG PermDbServiceSpringBoot - Bean erzeugt: org.apache.tomcat.dbcp.dbcp2.BasicDataSource@49f798a4
  11:31:05.986 [RMI TCP Connection(3)-127.0.0.1] DEBUG PermDbServiceSpringBoot - DataSource: org.apache.tomcat.dbcp.dbcp2.BasicDataSource@49f798a4
  11:31:06.017 [RMI TCP Connection(3)-127.0.0.1] DEBUG PermDbServiceSpringBoot - Bean erzeugt: org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean@439cc9b9
  2016-07-28 11:31:06.033  INFO 5636 --- [on(3)-127.0.0.1] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'PermDb'
  2016-07-28 11:31:06.049  INFO 5636 --- [on(3)-127.0.0.1] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
      name: PermDb
      ...]
  2016-07-28 11:31:06.205  INFO 5636 --- [on(3)-127.0.0.1] org.hibernate.Version                    : HHH000412: Hibernate Core {4.3.11.Final}
  2016-07-28 11:31:06.205  INFO 5636 --- [on(3)-127.0.0.1] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
  2016-07-28 11:31:06.205  INFO 5636 --- [on(3)-127.0.0.1] org.hibernate.cfg.Environment            : HHH000021: Bytecode provider name : javassist
  2016-07-28 11:31:06.501  INFO 5636 --- [on(3)-127.0.0.1] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
  2016-07-28 11:31:06.891  INFO 5636 --- [on(3)-127.0.0.1] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL9Dialect
  2016-07-28 11:31:06.906  INFO 5636 --- [on(3)-127.0.0.1] o.h.e.jdbc.internal.LobCreatorBuilder    : HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
  2016-07-28 11:31:07.187  INFO 5636 --- [on(3)-127.0.0.1] o.h.h.i.ast.ASTQueryTranslatorFactory    : HHH000397: Using ASTQueryTranslatorFactory
  2016-07-28 11:31:08.388  INFO 5636 --- [on(3)-127.0.0.1] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
  2016-07-28 11:31:08.404  INFO 5636 --- [on(3)-127.0.0.1] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'permDbJpaDataSource' has been autodetected for JMX exposure
  2016-07-28 11:31:08.404  INFO 5636 --- [on(3)-127.0.0.1] o.s.j.e.a.AnnotationMBeanExporter        : Located MBean 'permDbJpaDataSource': registering with JMX server as MBean [org.apache.tomcat.dbcp.dbcp2:name=permDbJpaDataSource,type=BasicDataSource]
  2016-07-28 11:31:08.420 ERROR 5636 --- [on(3)-127.0.0.1] o.s.boot.SpringApplication               : Application startup failed
  
  org.springframework.jmx.export.UnableToRegisterMBeanException: Unable to register MBean [org.apache.tomcat.dbcp.dbcp2.BasicDataSource@49f798a4] with key 'permDbJpaDataSource'; nested exception is javax.management.InstanceAlreadyExistsException: Catalina:type=DataSource,host=localhost,context=/permDb,class=javax.sql.DataSource,name="jdbc/permDb"
      at org.springframework.jmx.export.MBeanExporter.registerBeanNameOrInstance(MBeanExporter.java:625) ~[spring-context-4.2.7.RELEASE.jar:4.2.7.RELEASE]
      at org.springframework.jmx.export.MBeanExporter.registerBeans(MBeanExporter.java:550) ~[spring-context-4.2.7.RELEASE.jar:4.2.7.RELEASE]
      at org.springframework.jmx.export.MBeanExporter.afterSingletonsInstantiated(MBeanExporter.java:432) ~[spring-context-4.2.7.RELEASE.jar:4.2.7.RELEASE]
  </code></pre>