Issues Getting My Spring Boot Index Page and Controller Mappings To Work when Returning JSP View Name : I am using Spring Boot and JSP to learn some quick tutorials in Spring Security but my **controller mappings** and `index.jsp` are not working. It seems it can't locate the `JSP` pages. Here is my config and project structure::::


    springsecurity-for-reactive-apps [boot] - Project folder
      - src/main/java
        - com.springsecurity
          - SpringsecurityForReactiveAppsApplication.java
        - com.springsecurity.config
          - ApplicationConfig.java 
          - SecurityWebApplicationInitializer.java
          - SpringMvcWebApplicationInitializer.java 
          - SpringSecurityConfig.java 
          - WebApplicationConfig.java 
      - src
        - main
          - webapp
            - WEB-INF
              - view
                 - home.jsp
              - index.jsp




- **com.springsecurity** package contains ::

    @SpringBootApplication
    public class SpringsecurityForReactiveAppsApplication {
    
    	public static void main(String[] args) {
    		SpringApplication.run(SpringsecurityForReactiveAppsApplication.class, args);
    	}
    }


 **- com.springsecurity.config** package contains the following classes

   


     @Configuration
        public class ApplicationConfig {
        	
        	 @Value("${spring.datasource.driver-class-name}")
        	  private String DB_DRIVER;
            	  
            	  @Value("${spring.datasource.password}")
            	  private String DB_PASSWORD;
            	  
            	  @Value("${spring.datasource.url}")
            	  private String DB_URL;
            	  
            	  @Value("${spring.datasource.username}")
            	  private String DB_USERNAME;
            	  
            	@Autowired
            	private Environment env;
            	
            	@Bean
            	public DataSource getDataSource() {
            		DriverManagerDataSource dataSource = new DriverManagerDataSource();
            		dataSource.setDriverClassName(DB_DRIVER);
            		dataSource.setUrl(DB_URL);
                    dataSource.setUsername(DB_USERNAME);
                    dataSource.setPassword(DB_PASSWORD);
            		return dataSource;
            	}
            
            }
            
            
            public class SecurityWebApplicationInitializer extends AbstractSecurityWebApplicationInitializer{
            
            }
            
            
            
            public class SpringMvcWebApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer{
                @Override
                protected Class<?>[] getRootConfigClasses() {
                    return new Class[] { WebApplicationConfig.class };
                }
              
                @Override
                protected Class<?>[] getServletConfigClasses() {
                    return null;
                }
              
                @Override
                protected String[] getServletMappings() {
                    return new String[] { "/" };
                }
            }
            
            
            
            @Configuration
            @EnableWebSecurity
            //@EnableAutoConfiguration(exclude = {SecurityAutoConfiguration.class })
            public class SpringSecurityConfig extends WebSecurityConfigurerAdapter{
            	@Autowired
            	private DataSource dataSource;
            	
            	
            		
            		
            		
            		@Override
            		protected void configure(AuthenticationManagerBuilder auth) throws Exception{
            			auth.jdbcAuthentication().dataSource(dataSource)
            			    .usersByUsernameQuery("select username, password, enabled"
            	                       + " from users where username = ?")
            			    .authoritiesByUsernameQuery("select username, authority "
            	                       + "from authorities where username = ?")
            			    .passwordEncoder(new BCryptPasswordEncoder());
            		}
            		
            		@Override
            		protected void configure(HttpSecurity http) throws Exception {
            		       http.authorizeRequests().anyRequest().hasAnyRole("ADMIN", "USER")
            		               .and()
            		               .httpBasic(); // Use Basic authentication
            		   }
            }
            
            
            
            @Configuration
            @EnableWebMvc
            @ComponentScan(basePackages= {"com.springsecurity"})
            public class WebApplicationConfig implements WebMvcConfigurer{
            	@Override
            	public void configureViewResolvers(ViewResolverRegistry registry) {
            	       registry.jsp().prefix("/WEB-INF/view/").suffix(".jsp");
            	   }
            	
            	@Bean
            	public ViewResolver viewResolver() {
            		 InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
            	        viewResolver.setViewClass(JstlView.class);
            	        viewResolver.setPrefix("/WEB-INF/views/");
            	        viewResolver.setSuffix(".jsp");
            	        return viewResolver;
            	}
            
            }



 **- com.springsecurity.controller** contains:::

    @Controller
    public class HomeController {
    
    	@GetMapping("/home")
    	   public String home(Model model, Principal principal) {
    		System.out.println("___________home()___________________");
    	       return "home";
    	   }
    	
    	@GetMapping("/error")
    	   public String error(Model model, Principal principal) {
    		System.out.println("___________ERROR-<<error___________________");
    	       return "home";
    	   }
    	
    }

**POM.xml**

    <?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>
    
    	<groupId>com.springsecurity</groupId>
    	<artifactId>springsecurity-for-reactive-apps</artifactId>
    	<version>0.0.1-SNAPSHOT</version>
    	<packaging>jar</packaging>
    
    	<name>springsecurity-for-reactive-apps</name>
    	<description>Spring security for reactive applications</description>
    
    	<parent>
    		<groupId>org.springframework.boot</groupId>
    		<artifactId>spring-boot-starter-parent</artifactId>
    		<version>2.0.6.RELEASE</version>
    		<relativePath/> <!-- lookup parent from repository -->
    	</parent>
    
    	<properties>
    		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    		<java.version>1.8</java.version>
    	</properties>
    
    	<dependencies>
    		<dependency>
    			<groupId>org.springframework.boot</groupId>
    			<artifactId>spring-boot-starter-data-jpa</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework.boot</groupId>
    			<artifactId>spring-boot-starter-web</artifactId>
    		</dependency>
    
    		<dependency>
    			<groupId>mysql</groupId>
    			<artifactId>mysql-connector-java</artifactId>
    			<scope>runtime</scope>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework.boot</groupId>
    			<artifactId>spring-boot-starter-test</artifactId>
    			<scope>test</scope>
    		</dependency>
    		
    		
    		<!-- Spring dependencies START-->
    		<dependency>
    		   <groupId>org.springframework.security</groupId>
    		   <artifactId>spring-security-web</artifactId>
    		   </dependency>
    		<dependency>
    		   <groupId>org.springframework.security</groupId>
    		   <artifactId>spring-security-config</artifactId>
    		   </dependency>
    		<dependency>
    		   <groupId>org.springframework.security</groupId>
    		   <artifactId>spring-security-crypto</artifactId>
    		   </dependency>
    		<dependency>
    		   <groupId>org.springframework</groupId>
    		   <artifactId>spring-webmvc</artifactId>
    		   </dependency>
    		<dependency>
    		   <groupId>org.springframework</groupId>
    		   <artifactId>spring-jdbc</artifactId>
    		   </dependency>
    		<!-- Servlet and JSP related dependencies -->
    		<dependency>
    		   <groupId>javax.servlet</groupId>
    		   <artifactId>javax.servlet-api</artifactId>
    		   <scope>provided</scope>
    		</dependency>
    		<dependency>
    		   <groupId>javax.servlet.jsp</groupId>
    		   <artifactId>javax.servlet.jsp-api</artifactId>
    		   <version>2.3.1</version>
    		   <scope>provided</scope>
    		</dependency>
    		<dependency>
    		   <groupId>javax.servlet.jsp.jstl</groupId>
    		   <artifactId>javax.servlet.jsp.jstl-api</artifactId>
    		   <version>1.2.1</version>
    		</dependency>
    		<dependency>
    		   <groupId>taglibs</groupId>
    		   <artifactId>standard</artifactId>
    		   <version>1.1.2</version>
    		</dependency>
    		<!-- For datasource configuration -->
    		<dependency>
    		   <groupId>org.apache.commons</groupId>
    		   <artifactId>commons-dbcp2</artifactId>
    		   </dependency>
    		<!-- We will be using MySQL as our database server -->
    		<dependency>
    		   <groupId>mysql</groupId>
    		   <artifactId>mysql-connector-java</artifactId>
    		   <version>6.0.6</version>
    		</dependency>   
     		<!-- Spring dependencies END -->		
    		
    </dependencies>
    	<build>
    		<plugins>
    			<plugin>
    				<groupId>org.springframework.boot</groupId>
    				<artifactId>spring-boot-maven-plugin</artifactId>
    			</plugin>
    		</plugins>
    	</build>
    </project>




I have spent almost two days googling but couldn't find answer.
Any help will be appreciated
thanks

























