title: Spring boot non-fatal errors ClassNotFoundException
body: <p>I'm trying to create Spring Boot application for collaboration with Apache ActiveMQ. </p>
  
  <p>During startup I receiving following "non-fatal" errors:</p>
  
  <pre><code>java.lang.ClassNotFoundException: org.springframework.data.web.config.EnableSpringDataWebSupport
      at java.net.URLClassLoader$1.run(Unknown Source) ~[na:1.8.0_25]
      at java.net.URLClassLoader$1.run(Unknown Source) ~[na:1.8.0_25]
      at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_25]
      at java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.8.0_25]
      at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_25]
      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) ~[na:1.8.0_25]
      at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_25]
  
  java.lang.ClassNotFoundException: org.springframework.security.config.annotation.web.configuration.EnableWebSecurity
      at java.net.URLClassLoader$1.run(Unknown Source) ~[na:1.8.0_25]
      at java.net.URLClassLoader$1.run(Unknown Source) ~[na:1.8.0_25]
      at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_25]
      at java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.8.0_25]
      at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_25]
      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) ~[na:1.8.0_25]
      at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_25]
  </code></pre>
  
  <p>This is my files:</p>
  
  <pre><code>@Configuration
  @EnableJms
  public class ActiveMQTestConfig {
  
      @Bean
      // Strictly speaking this bean is not necessary as boot creates a default
      JmsListenerContainerFactory&lt;?&gt; myJmsContainerFactory(ConnectionFactory connectionFactory) {
          SimpleJmsListenerContainerFactory factory = new SimpleJmsListenerContainerFactory();
          factory.setConnectionFactory(connectionFactory);
          return factory;
      }
  
  }
  
  @Configuration
  @ComponentScan("com.example.messages")
  @SpringBootApplication
  public class TestConfig {    
  }
  
  @Component
  public class Receiver {
  
      /**
       * Get a copy of the application context
       */
      @Autowired
      ConfigurableApplicationContext context;
  
      /**
       * When you receive a message, print it out, then shut down the application.
       * Finally, clean up any ActiveMQ server stuff.
       */
      @JmsListener(destination = "mailbox-destination", containerFactory = "myJmsContainerFactory")
      public void receiveMessage(String message) {
          System.out.println("Received &lt;" + message + "&gt;");
          context.close();
          FileSystemUtils.deleteRecursively(new File("activemq-data"));
      }
  
  }
  
  @SpringApplicationConfiguration(classes = { TestConfig.class, ActiveMQTestConfig.class })
  @RunWith(SpringJUnit4ClassRunner.class)
  public class ReceiverTest {
  
      @Autowired
      private JmsTemplate jmsTemplate;
  
      @Test
      public void testReceiver() {
          // Clean out any ActiveMQ data from a previous run
          FileSystemUtils.deleteRecursively(new File("activemq-data"));
  
          // Send a message
          MessageCreator messageCreator = new MessageCreator() {
              @Override
              public Message createMessage(Session session) throws JMSException {
                  return session.createTextMessage("ping!");
              }
          };
  
          System.out.println("Sending a new message.");
          jmsTemplate.send("mailbox-destination", messageCreator);
  
      }
  
  }
  </code></pre>
  
  <p>Logging configuration - logback.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;configuration&gt;
      &lt;appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"&gt;
          &lt;layout class="ch.qos.logback.classic.PatternLayout"&gt;
              &lt;Pattern&gt;
                  %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
              &lt;/Pattern&gt;
          &lt;/layout&gt;
      &lt;/appender&gt;
  
      &lt;logger name="org.springframework" level="debug" additivity="false"&gt;
          &lt;appender-ref ref="STDOUT" /&gt;
      &lt;/logger&gt;
  
      &lt;root level="error"&gt;
          &lt;appender-ref ref="STDOUT" /&gt;
      &lt;/root&gt;
  
  &lt;/configuration&gt;
  </code></pre>
  
  <p>Dependencies configuration from parent-pom:</p>
  
  <pre><code>&lt;!-- jUnit --&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;junit&lt;/groupId&gt;
      &lt;artifactId&gt;junit&lt;/artifactId&gt;
      &lt;version&gt;${junit.version}&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  
  &lt;!-- Aspectj --&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.aspectj&lt;/groupId&gt;
      &lt;artifactId&gt;aspectjrt&lt;/artifactId&gt;
      &lt;version&gt;${aspectj.version}&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.aspectj&lt;/groupId&gt;
      &lt;artifactId&gt;aspectjweaver&lt;/artifactId&gt;
      &lt;version&gt;${aspectj.version}&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.aspectj&lt;/groupId&gt;
      &lt;artifactId&gt;aspectjtools&lt;/artifactId&gt;
      &lt;version&gt;${aspectj.version}&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;!-- Spring --&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.springframework&lt;/groupId&gt;
      &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
      &lt;version&gt;${spring.version}&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.springframework&lt;/groupId&gt;
      &lt;artifactId&gt;spring-beans&lt;/artifactId&gt;
      &lt;version&gt;${spring.version}&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.springframework&lt;/groupId&gt;
      &lt;artifactId&gt;spring-aop&lt;/artifactId&gt;
      &lt;version&gt;${spring.version}&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.springframework&lt;/groupId&gt;
      &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
      &lt;version&gt;${spring.version}&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.springframework&lt;/groupId&gt;
      &lt;artifactId&gt;spring-expression&lt;/artifactId&gt;
      &lt;version&gt;${spring.version}&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;!-- Spring boot --&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot&lt;/artifactId&gt;
      &lt;version&gt;${spring.boot.version}&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-autoconfigure&lt;/artifactId&gt;
      &lt;version&gt;${spring.boot.version}&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-logging&lt;/artifactId&gt;
      &lt;version&gt;${spring.boot.version}&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
      &lt;version&gt;${spring.boot.version}&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;javax.enterprise&lt;/groupId&gt;
      &lt;artifactId&gt;cdi-api&lt;/artifactId&gt;
      &lt;version&gt;${cdi-api.version}&lt;/version&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;${commons-lang3.version}&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;commons-validator&lt;/groupId&gt;
      &lt;artifactId&gt;commons-validator&lt;/artifactId&gt;
      &lt;version&gt;${commons-validator.version}&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;commons-io&lt;/groupId&gt;
      &lt;artifactId&gt;commons-io&lt;/artifactId&gt;
      &lt;version&gt;${commons-io.version}&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;!-- Logging --&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
      &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
      &lt;version&gt;${slf4j.version}&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;
      &lt;artifactId&gt;logback-classic&lt;/artifactId&gt;
      &lt;version&gt;${logback.version}&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p></p>
  
  <p>Dependencies configuration from this project:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.springframework&lt;/groupId&gt;
      &lt;artifactId&gt;spring-jms&lt;/artifactId&gt;
      &lt;version&gt;${spring.version}&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.apache.activemq&lt;/groupId&gt;
      &lt;artifactId&gt;activemq-broker&lt;/artifactId&gt;
      &lt;version&gt;${activemq.version}&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>How to prevent Spring Boot from looking for unused classes and annotations ? I don't need any web related stuff in this project.</p>