Spring Deployment / Hosting Boot Application

I recently finished a simple spring boot application using the INTELLIJ IDE. Applications run locally as a spring application, as well as in Tomcat.

For my next step, I would like to be able to host the application online, but every attempt I made does not seem to work, does not even run on Xampp Tomcat.

Here is my hierarchy:

  • CSI
  • ---- Java
  • --------- com.jcode
  • --------------- TestController.java
  • --------------- Application.java
  • ---- resources
  • --------- application.properties

application.properties:

spring.datasource.driver-class-name = com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://xxx.xxx.xxx.xxx:3306/db_digitrainer
spring.datasource.username=test
spring.datasource.password=test

server.context-path=/digitrainer

management.context-path=/manage

Application.java:

@SpringBootApplication
@Configuration
@EnableAutoConfiguration
@EnableWebMvc
@ComponentScan
public class Application extends SpringBootServletInitializer {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(Application.class);
    }

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

I was not able to find clear information on how to do this, so I would like to know that I am doing something wrong, and also if spring boot is an approach for developing an API for rest.

+4
2

Pivotal Could Foundry . guide STS. - IDE . , Spring Boot REST API .

0

, . , WAR , . WAR , .

, , , cmd, maven mvn package. .

0

Source: https://habr.com/ru/post/1608025/


All Articles