Our requirement is very simple we would like to create a Spring boot microservice and would like to fetch the content from Tridion.

We have identified 2 ways of doing it 

 - Either add minimal DXA dependency and configuration to spring boot
   project and fetch content  
 - Convert DXA-WebApp to spring boot project    and our changes on top
   of it.

We decided to go with latter option as there were some configuration file and some standard dxa code which already works. We added spring boot dependencies and in the main class implemented the WebApplicationInitializer to pick up the configuration but we keep getting the following exception. Please find attached POM and Main class.
following exception and hit a roadblock

14:36:03.265 [main] ERROR o.s.boot.SpringApplication - Application startup failed
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.BootApplication]; nested exception is java.io.FileNotFoundException: class path resource [com/sdl/web/content/controller/ContentV2Controller.class] cannot be opened because it does not exist.

Can you please tell us if we go with first option (add minimal DXA dependency and configuration to spring boot project) what will be the configuration required or how to fix the above error ?

        <?xml version="1.0" encoding="UTF-8"?>
    <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">
    	<modelVersion>4.0.0</modelVersion>
    
    	<version>0.0.1-SNAPSHOT</version>
    	<groupId>com.sdl.dxa</groupId>
    	<artifactId>dxawebapp</artifactId>
    	<packaging>war</packaging>
    	<name>DXA - Webapp</name>
    	<description>Example web application for DXA</description>
    	<url>http://www.sdl.com/cxc/digital-experience/web-experience-management/digital-experience-accelerator.html</url>
    
    	<properties>
    		<dxa-bom.version>1.7.0</dxa-bom.version>
    		<dxa-release-branch>release/1.7</dxa-release-branch>
    		<java-version>1.8</java-version>
    		<spring.version>4.3.7.RELEASE</spring.version>
    	</properties>
    	<parent>
    		<groupId>org.springframework.boot</groupId>
    		<artifactId>spring-boot-starter-parent</artifactId>
    		<version>1.5.2.RELEASE</version>
    
    	</parent>
    	<scm>
    		<url>https://github.com/sdl/dxa-web-application-java</url>
    		<connection>scm:git:[email protected]:sdl/dxa-web-application-java.git</connection>
    		<developerConnection>scm:git:[email protected]:sdl/dxa-web-application-java.git</developerConnection>
    		<tag>HEAD</tag>
    	</scm>
    
    
    
    	<repositories>
    		<repository>
    			<id>github-project-repo</id>
    			<url>https://raw.githubusercontent.com/sdl/dxa-web-application-java/${dxa-release-branch}/local-project-repo</url>
    		</repository>
    		<repository>
    			<id>local-project-repo</id>
    			<url>file:///${project.basedir}/../local-project-repo</url>
    		</repository>
    	</repositories>
    
    	<build>
    		<finalName>${project.artifactId}</finalName>
    		<plugins>
    			<plugin>
    				<groupId>org.springframework.boot</groupId>
    				<artifactId>spring-boot-maven-plugin</artifactId>
    			</plugin>
    			<plugin>
    				<groupId>org.apache.maven.plugins</groupId>
    				<artifactId>maven-compiler-plugin</artifactId>
    				<version>3.1</version>
    				<configuration>
    					<source>${java-version}</source>
    					<target>${java-version}</target>
    				</configuration>
    			</plugin>
    			<plugin>
    				<groupId>org.apache.maven.plugins</groupId>
    				<artifactId>maven-war-plugin</artifactId>
    				<version>2.4</version>
    				<configuration>
    					<failOnMissingWebXml>false</failOnMissingWebXml>
    					<archive>
    						<manifest>
    							<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
    							<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
    						</manifest>
    					</archive>
    				</configuration>
    			</plugin>
    		</plugins>
    	</build>
    
      	<profiles>
    		<profile>
    			<id>core-module</id>
    			<dependencies>
    				<dependency>
    					<groupId>com.sdl.dxa.modules</groupId>
    					<artifactId>dxa-module-core</artifactId>
    				</dependency>
    			</dependencies>
    		</profile>
    		<profile>
    			<id>cid-module</id>
    			<dependencies>
    				<dependency>
    					<artifactId>dxa-module-cid</artifactId>
    					<groupId>com.sdl.dxa.modules</groupId>
    				</dependency>
    			</dependencies>
    		</profile>
    		<profile>
    			<id>search-module</id>
    			<dependencies>
    				<dependency>
    					<groupId>com.sdl.dxa.modules</groupId>
    					<artifactId>dxa-module-search</artifactId>
    				</dependency>
    			</dependencies>
    		</profile>
    		<profile>
    			<id>context-expressions-module</id>
    			<dependencies>
    				<dependency>
    					<artifactId>dxa-module-context-expressions</artifactId>
    					<groupId>com.sdl.dxa.modules</groupId>
    				</dependency>
    			</dependencies>
    		</profile>
    		<profile>
    			<id>googleanalytics-module</id>
    			<dependencies>
    				<dependency>
    					<groupId>com.sdl.dxa.modules</groupId>
    					<artifactId>dxa-module-googleanalytics</artifactId>
    				</dependency>
    			</dependencies>
    		</profile>
    		<profile>
    			<id>mediamanager-module</id>
    			<dependencies>
    				<dependency>
    					<groupId>com.sdl.dxa.modules</groupId>
    					<artifactId>dxa-module-mediamanager</artifactId>
    				</dependency>
    			</dependencies>
    		</profile>
    		<profile>
    			<id>smarttarget-web8-module</id>
    			<dependencies>
    				<dependency>
    					<groupId>com.sdl.dxa.modules</groupId>
    					<artifactId>dxa-module-smarttarget-web8</artifactId>
    				</dependency>
    			</dependencies>
    		</profile>
    		<profile>
    			<id>51degrees-module</id>
    			<dependencies>
    				<dependency>
    					<groupId>com.sdl.dxa.modules</groupId>
    					<artifactId>dxa-module-51degrees</artifactId>
    				</dependency>
    			</dependencies>
    		</profile>
    		<profile>
    			<id>audience-manager-web8-module</id>
    			<dependencies>
    				<dependency>
    					<groupId>com.sdl.dxa.modules</groupId>
    					<artifactId>dxa-module-audience-manager-web8</artifactId>
    				</dependency>
    			</dependencies>
    		</profile>
    		<profile>
    			<id>test-module</id>
    			<dependencies>
    				<dependency>
    					<groupId>com.sdl.dxa.modules</groupId>
    					<artifactId>dxa-module-test</artifactId>
    				</dependency>
    			</dependencies>
    		</profile>
    	</profiles>  
    
    	<dependencyManagement>
    		<dependencies>
    			<dependency>
    				<groupId>com.sdl.dxa</groupId>
    				<artifactId>dxa-bom</artifactId>
    				<version>${dxa-bom.version}</version>
    				<type>pom</type>
    				<scope>import</scope>
    			</dependency>
    			<dependency>
    				<groupId>com.sdl.dxa.modules</groupId>
    				<artifactId>dxa-bom-modules</artifactId>
    				<version>${dxa-bom.version}</version>
    				<type>pom</type>
    				<scope>import</scope>
    			</dependency>
    		</dependencies>
    	</dependencyManagement>
    
    	<!-- Dependencies -->
    	<dependencies>
    
    		<dependency>
    			<groupId>org.springframework.boot</groupId>
    			<artifactId>spring-boot-actuator</artifactId>
    		</dependency>
    
    		<dependency>
    			<groupId>org.springframework.boot</groupId>
    			<artifactId>spring-boot-starter-web</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework.boot</groupId>
    			<artifactId>spring-boot-starter</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework.boot</groupId>
    			<artifactId>spring-boot-autoconfigure</artifactId>
    			<scope>runtime</scope>
    		</dependency>
    
    		<!-- SDL Digital Experience Accelerator -->
    		<dependency>
    			<groupId>com.sdl.dxa</groupId>
    			<artifactId>dxa-common-api</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>com.sdl.dxa</groupId>
    			<artifactId>dxa-common-impl</artifactId>
    		</dependency>
    
    		<dependency>
    			<groupId>com.sdl.dxa</groupId>
    			<artifactId>dxa-web8-provider</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>com.sdl.dxa</groupId>
    			<artifactId>dxa-tridion-provider</artifactId>
    		</dependency>
    		<!-- https://mvnrepository.com/artifact/com.sdl.dxa/dxa-data-model -->
    		<dependency>
    			<groupId>com.sdl.dxa</groupId>
    			<artifactId>dxa-data-model</artifactId>
    			<version>2.0.0-CTP1</version>
    		</dependency>
    		<!-- https://mvnrepository.com/artifact/com.sdl.dxa/dxa-dd4t-provider -->
    		<dependency>
    			<groupId>com.sdl.dxa</groupId>
    			<artifactId>dxa-dd4t-provider</artifactId>
    			<version>2.0.0-CTP1</version>
    		</dependency>
    		<!-- https://mvnrepository.com/artifact/com.sdl.dxa/dxa-compatible -->
    		<dependency>
    			<groupId>com.sdl.dxa</groupId>
    			<artifactId>dxa-compatible</artifactId>
    			<version>2.0.0-CTP1</version>
    		</dependency>
    
    
    
    		<!-- https://mvnrepository.com/artifact/com.sdl.dxa/dxa-r2-provider -->
    		<dependency>
    			<groupId>com.sdl.dxa</groupId>
    			<artifactId>dxa-r2-provider</artifactId>
    			<version>2.0.0-CTP1</version>
    		</dependency>
    
    
    
    		<!-- <dependency> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> 
    			</dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> 
    			</dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> 
    			</dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> 
    			</dependency> -->
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-beans</artifactId>
    			<version>${spring.version}</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-context</artifactId>
    			<version>${spring.version}</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-web</artifactId>
    			<version>${spring.version}</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-webmvc</artifactId>
    			<version>${spring.version}</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-expression</artifactId>
    			<version>${spring.version}</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-aop</artifactId>
    			<version>${spring.version}</version>
    		</dependency>
    
    		<dependency>
    			<groupId>org.slf4j</groupId>
    			<artifactId>slf4j-api</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>javax.servlet</groupId>
    			<artifactId>javax.servlet-api</artifactId>
    		</dependency>
    
    		<!-- Testing -->
    		<dependency>
    			<groupId>junit</groupId>
    			<artifactId>junit</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.mockito</groupId>
    			<artifactId>mockito-all</artifactId>
    		</dependency>
    	</dependencies>
    
    </project>

Main Class 

        package com;
    
    import static com.sdl.webapp.common.util.InitializationUtils.loadActiveSpringProfiles;
    import static com.sdl.webapp.common.util.InitializationUtils.registerListener;
    import static com.sdl.webapp.common.util.InitializationUtils.registerServlet;
    
    import javax.servlet.ServletContext;
    import javax.servlet.ServletException;
    
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
    import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
    import org.springframework.boot.builder.SpringApplicationBuilder;
    import org.springframework.boot.web.support.SpringBootServletInitializer;
    import org.springframework.web.WebApplicationInitializer;
    import org.springframework.web.context.ContextLoaderListener;
    import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
    import org.springframework.web.servlet.DispatcherServlet;
    
    import com.sdl.dxa.dxawebapp.SpringInitializer;
    
    @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class}) 
    public class BootApplication extends SpringBootServletInitializer implements WebApplicationInitializer{
    
    	@Override
        public void onStartup(ServletContext servletContext) throws ServletException {
            //log.debug("Initializing servlet application context");
            AnnotationConfigWebApplicationContext servletAppContext = new AnnotationConfigWebApplicationContext();
    
            // register webapp spring configuration
            servletAppContext.register(SpringInitializer.class);
    
            //log.debug("Registering Spring ContextLoaderListener");
            registerListener(servletContext, new ContextLoaderListener(servletAppContext));
    
            //log.debug("Registering Spring DispatcherServlet");
            registerServlet(servletContext, new DispatcherServlet(servletAppContext), "/").setLoadOnStartup(1);
    
            loadActiveSpringProfiles(servletContext, servletAppContext);
        }
    		public static void main(String[] args) throws Exception {
    			SpringApplication.run(BootApplication.class, args);
    		}
    }