Java – deploy / host spring boot applications

I recently completed a simple spring launch application using the IntelliJ ide The application runs locally as a spring application and Tomcat

For my next step, I hope to host the application online, but every attempt I make seems to fail, and I don't even run on xampp's Tomcat

Successor my hierarchy:

> src > —- java > ——— com. jcode > —————TestController. java > —————Application. Java > -- resource > -- 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 haven't been able to find any clear information about how to do this, so I'd like to know if I did something wrong, and if spring boot is the way to develop the rest API

Solution

I found seamless deployment on pivotal can foundry For this reason, this guide works well when using STS This blog post can be useful when using other ides, or for detailed steps Yes, I found that spring boot is very suitable for developing rest APIs and is almost close to developing the first version of an open source project for this purpose

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>