Unable to run localhost in Spring Boot application (Tomcat server) - maven

I've been learning Spring using the following tutorials: https://www.youtube.com/playlist?list=PLqq-6Pq4lTTbx8p2oCgcAQGQyqN8XeA1x
I have created a Maven project and tried to run the Spring Boot application while referring to these videos:
https://www.youtube.com/watch?v=E7_a-kB46LU&index=9&list=PLqq-6Pq4lTTbx8p2oCgcAQGQyqN8XeA1x
I tried to run my Spring application on Tomcat server but the localhost isn't working. (Port 8080)
My pom.xml looks like this:
<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>io.javabrains.springbootquickstart</groupId>
<artifactId>course-api-new</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Java Brains Course API</name>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<properties>
<java.version>1.8</java.version>
</properties>
</project>
CourseApiApp.java :
package io.javabrains.springbootstarter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class CourseApiApp {
public static void main(String[] args) {
SpringApplication.run(CourseApiApp.class, args);
}
}
According to the video localhost should display Whitelist error on running the application, but it doesn't run at all.
Any help would be appreciated, thanks!

I would suggest that you start your project from beginning. To create a valid spring-boot project you have a very good web based generator for spring-boot starter applications.
https://start.spring.io/
For a web application with an embedded tomcat you should use web project.
Using STS you can create the same by choosing new -> spring starter project.
A wizard will appear and you can choose your project informations:
And then in the second step you dependencies:
After generating your project your pom.xml should look like that:
<?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.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.4.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-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Your application should start normally and tomcat listens on localhost:8080.
EDIT
The starter just have a new design:

Solution: add web starter dependency to pom.xml for maven
No need to create new app. Just change this starter dependency to starter-web dependency:
Starter
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
Starter Web
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

You should try to run spring-boot as sudo
sudo mvn spring-boot:run

It could be possible that STS by default uses Tomcat version 7 and if you happen to use version 8, then would need to specify the same in pom.xml
<properties>
<tomcat.version>8.0.47</tomcat.version>
</properties>

I also faced the same issue. Try creating Spring Boot apprlication by choosing Spring Boot starter project in STS.
Right click on STS->New->Spring Starter Project->Give name and click on Next->Choose Web and tick mark on Web and search for Dev Tools and tick mark Dev Tools and click on Finish
Now click on the project and Run as Spring Boot Application.

In application.properties put server.port=8080

I faced the similar issue. I too was following the JavaBrains SpringBoot example. This is what I did:
I created a fresh spring boot project using STS tool and included the same code as provided by you and it worked!

You need to tell springboot where do you have to scan your reference classes
#SpringBootApplication
#ComponentScan(basePackages= {"com.testbean.controller", "com.testbean.model", "com.testbean.service"})
public class DemoApplication {

Use #ComponentScan("io.javabrains") and mention the package in which the Controller is present. eg.
#SpringBootApplication
#ComponentScan("io.javabrains")
public class CourseApiApp {
public static void main(String[] args) {
SpringApplication.run(CourseApiApp.class, args);
}
}
In a spring boot application, by default spring searches for components in the same package which is having the #SpringBootApplication annotation.

Follow this tutorial to setup JavaJDK, Tomcat and Maven: https://jeromejaglale.com/doc/spring4_tutorial/installation_macos
Next step move to Terminal app: type cd root_project and run sudo mvn spring-boot:run

I managed to solve with a tip above the server.port
I added as said: server.port = 8090 and it worked.
https://drive.google.com/file/d/1lZAEaD5VZdpnyffROn9X37mZm4vaQJ9G/view?usp=sharing

Related

How to run Swagger 3 on Spring Boot 3

Using a fresh Spring Initialzr with Java17 and Spring Boot 3.0.0, and an extra addition to the pom.xml for Springfox Swagger 3, I can't for the life of me get Swagger pages to work. Instead, I get the whitelabel error page with 404.
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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
The standard Swagger URLs as defined in this Github Issues page aren't working for the above pom.xml project.
I had given up and went to use Spring Boot 2.7 after posting the question. But, after seeing Dmitriy's answer though, I checked Springdoc one last time and found that Springdoc v2 does support Spring Boot 3.
Essentially, one has to place the following in their pom:
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.0.0</version>
</dependency>
Then one can access the Swagger page using the following URL: http://localhost:8080/swagger-ui.html (Don't forget to add context path if you need it). For some reason, when opening, it redirects to http://localhost:8080/swagger-ui/index.html although going for that initially returned 404...
in addition to adding springdoc-openapi-starter-webmvc-ui (v2.0.2 for me) as indicated in the accepted answer, I also needed to remove org.springdoc:springdoc-openapi-ui:1.6.13 .
It was there because I had tried it before. If present, there's still a non Jakarta reference that Spring tries to resolve (and fails to do so).
I also needed to add this dependency, otherwise I would have a nasty message at startup (version is resolved by Spring Boot BOM) :
implementation group: 'org.hibernate.validator', name: 'hibernate-validator'
Lastest
springfox-boot-starter version 3.0.0
and
springdoc-openapi-ui 1.6.13
seems not to support spring-boot 3.
We need to wait until the new version adopts jakarta.servlet package
Springdoc is working with Spring boot 3.0.1
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.0.2</version>
</dependency>
Default URL: http://localhost:8080/swagger-ui/index.html
For Gradle you can add this:
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.0'
I agreed with #Ahmed Tawfik because I also faced the same. But today I tried that same approach with the new version of "springdoc-openapi-starter-webmvc-ui" dependency and Spring Boot 3.0.2-SNAPSHOT.
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.0.2</version>
</dependency>
because the previous one "springdoc-openapi-ui" is changed to the above one.
Also, include below the path to the security config for swagger UI.
"/v3/api-docs/**","/swagger-ui/**"
For my project,
#Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
return http.cors(AbstractHttpConfigurer::disable)
.csrf(AbstractHttpConfigurer::disable)
.exceptionHandling(exceptionHandlingConfigurer -> exceptionHandlingConfigurer.authenticationEntryPoint(unauthorizedHandler))
.authorizeHttpRequests(authorizationManagerRequestMatcherRegistry -> {
try {
authorizationManagerRequestMatcherRegistry
.requestMatchers(HttpMethod.POST, POST_AUTH_WHITELIST).permitAll()
.requestMatchers(HttpMethod.GET, GET_AUTH_WHITELIST).permitAll()
.requestMatchers("/v3/api-docs/**", "/swagger-ui/**").permitAll()
.anyRequest()
.authenticated()
.and()
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS));
} catch (Exception e) {
throw new ResourceNotFoundException(e.getMessage());
}
}
)
.formLogin(AbstractHttpConfigurer::disable)
.httpBasic(AbstractHttpConfigurer::disable).addFilterBefore(jwtAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class)
.authenticationProvider(daoAuthenticationProvider()).build();
}
The swagger UI link will be:
http://server:port/context-path/swagger-ui.html
Please adjust the server, port, and context-path regarding your personal changes.
All the above steps are working fine with my project. I don't need extra configuration.
Also, you can add the custom path (Optional):
springdoc.swagger-ui.path=/swagger-ui.html
Here is the Official Documentation of OpenApi 3 and Spring Boot : https://springdoc.org/v2/#features
In the above documentation, you can explore additional configurations and other things also.
Happy Learning! ✌️
Use Open API instead swagger for Spring v3.0. Follow this document Open API Docs
Following dependencies working fine to me.
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.sample.app</groupId>
<artifactId>hello-world</artifactId>
<version>1.0.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.1</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
</project>

Spring Boot Application displays no error, but tomcat not initialized and application.properties is unused

I created a new project using Spring Initializr, and opened it with Intellij IDEA version 2020.3.2 ide. After maven installed all dependencies in the pom.xml file, I ran the main method in the DemoApplication class. I didn't add anything new or different than the default project created by the Spring Initializr.
Two Problems occured:
1- Console outputted only these 3 logs, and Tomcat wasn't initialized
2021-02-03 23:48:45.073 INFO 15872 --- [ main] com.example.DemoApplication: Starting DemoApplication using Java 1.8.0_281 on DESKTOP-M with PID 15872 (D:\demo\target\classes started by M in D:\demo)
2021-02-03 23:48:45.078 INFO 15872 --- [ main] com.example.DemoApplication : No active profile set,falling back to default profiles: default
2021-02-03 23:48:46.355 INFO 15872 --- [ main] com.example.DemoApplication: Started DemoApplication in 2.062 seconds (JVM running for 2.87)
Process finished with exit code 0
2- Anything I write in the application.properties file turns grey (unused)
I watched a lot of tutorials, and did exactly as they do. Their console output always has more than 3 statements and is even colored, which mine isn't
My 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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
DemoApplication.java
package com.example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
Would appreciate it if you would help me figure out how to correctly run the project and have the server up and running.
Should I add anymore run Options?
External Libraries:
This issue is reproducible with a simple war initializer, when you run DemoApplication with a "standalone java" (IDE run) configuration.
The solution/correct usage is: To run (the project) in a "maven" spring-boot:run (IDE run) configuration.
Like:
It looks like you are using IntelliJ IDEA Community Edition which has no support for Spring Boot.
That is why the properties are not highlighted and the output is not colored.
IntelliJ IDEA Ultimate will use Spring Boot Run/Debug configuration type automatically:
As a workaround you can run your code via Maven spring-boot:run.
I saw the same behavior when I setup a project with pox.xml you provided.
The "Include dependencies with "Provided" fixed it for me. However I had to reload the Maven dependencies like this a few times: pom.xml (right click) -> Maven -> Reload Project.
I would still suggest that you remove <scope>provided</scope> in spring-boot-starter-tomcat.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<!-- Comment this out -->
<!-- <scope>provided</scope> -->
</dependency>
Here is a good answer - Java Spring Boot - spring-boot-starter-tomcat dependency doesn't work with scope provided when running locally
If you still need this project to run in an external Tomcat container and thus want to mark the spring-boot-spring-boot-starter dependency as "provided", you can specify a separate profile for that configuration - https://stackoverflow.com/a/42302247

Getting error while implementing a project to start spring cloud dataflow server on local

I am implementing very basic POC to start spring cloud dataflow server on local.
But I am getting below error :
Field appRegistry in
org.springframework.cloud.dataflow.completion.CompletionConfiguration
required a bean of type
'org.springframework.cloud.dataflow.registry.service.AppRegistryService'
that could not be found. The injection point has the following
annotations:
-#org.springframework.beans.factory.annotation.Autowired(required=true)
pom.xml
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ms</groupId>
<artifactId>abc-ui</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>abc-ui</name>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.2.RELEASE</version>
</parent>
<properties>
<java.version>8</java.version>
<h2.version>1.4.193</h2.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-dataflow-server</artifactId>
<version>2.5.1.RELEASE</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
</dependencies>
</project>
Java file :
#EnableDataFlowServer
#SpringBootApplication(exclude = {CloudFoundryDeployerAutoConfiguration.class})
public class App {
public static void main(String[] args) {
SpringApplication.run(App.class,args);
}
}
Is there any way to disable "AppRegistry" bean configuration?
I have implemented same project in another system and it is working fine.
Please let me know what mistake I am making.
The AppRegistryService is a required component for SCDF as it is the source of truth for all the applications registered for Stream and Task applications.
Hence, there is no way to disable it explicitly. But, you can still have a different implementation of AppRegistryService and have it override the existing one though.

Spring project error using thymeleaf, Compilation failure. How can I fix this?

I'm pretty new at Spring framework, and I try to start a project for practice.
But I have an error and I have no idea how to fix this.
I've created a new Spring project in IntelliJ Idea, with Spring Initializr option (In Intellij, not with start.spring.io ). I added only 2 dependedncies for start (Web and Thymeleaf), but it throws error for Thymeleaf dependency if i run it with
'mvn spring-boot:run' command.
My spring project is "empty" , I have no controllers, beans, jpa entites, etc.. but it i think it shound run in this way too. I just wanted to make sure if it works if I run it.
If I create a same project, without Thymeleaf dependency (only Web dependency), it starts correctly on localhost.
I'm using Java 9.0.4 and Apache Maven 3.5.3
My error log
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.example</groupId>
<artifactId>demo_thymeleaf</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demo_thymeleaf</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.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>9</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</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-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
I solved it with deleting the whole C\Users\user.m2 directory.
After then with 'mvn spring-boot:run' it started successfully on localhost.
But I've got one more question:
When I run it, at terminal there are a couple of Warning messages.
Spring application runs anyway, but is there something to do with these messages?
Warning messages during Spring application run.

Spring Boot - Spring Rest - Build Package

I am learning Spring Boot. I have just created my first project using maven, Spring Boot, Spring Rest support and MongoDB. It compiles successfully, but it resolves all the dependencies, but do not compile the java classes at all.
After compilation, jar file is correctly created, it contain lib folder, metadata etc, but it do not contain project class file at all.
Hence when i run the project with mvn spring-boot:run, it throws an exception that class not found (Main method class for Spring boot initialization).
Please suggest, what I am doing wrong here, here is my maven configuration class:
<?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>
<properties>
<java.version>1.6</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<start-class>com.assignment.BootInitializer</start-class>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.1.9.RELEASE</version>
</parent>
<groupId>com.assignment</groupId>
<artifactId>spring-assignment</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
And here is the main initializer class:
package com.assignment;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
#Configuration
#EnableAutoConfiguration
#ComponentScan
public class BootInitializer {
public static void main(String[] args) {
SpringApplication.run(BootInitializer.class, args);
}
}
What I need to do, to ensure that maven is compiling the java classes and including them in the jar file.
Thanks.
I am learning Spring Boot.
Okay, good. Let's do one step at a time. Go to start.spring.io and generate a template project with whatever dependencies you want and whatever build tool (maven / gradle) you like. Build it and run it and see whether it is coming up or not. Then incrementally build on top of it.

Resources