道路环境监测node后端和java后台代码
wangrong
2021-11-24 ac1a5f4542431c28b5865acbeb81985cefdbc2a8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package com.example.demo;
 
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.client.RestTemplate;
import xyz.erupt.core.annotation.EruptScan;
 
import java.awt.*;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
 
@SpringBootApplication
@ComponentScan({"xyz.erupt", "com.example.demo"}) // ↓ xyz.erupt必须有
@EntityScan({"xyz.erupt", "com.example.demo"})    // ↓ 如果包名com.example.demo有变化
@EruptScan({"xyz.erupt", "com.example.demo"})     // → 要修改为变化后的包名
@EnableScheduling
public class ExampleApplication extends SpringBootServletInitializer {
//public class ExampleApplication {
 
    //详细使用方法详见项目内 README.md 文件说明
    public static void main(String[] args) throws URISyntaxException, IOException {
        SpringApplication.run(ExampleApplication.class, args);
        System.setProperty("java.awt.headless", "false");
        Desktop.getDesktop().browse(new URI("http://localhost:8099"));
        System.err.println("详细使用方法,请阅读:README.md");
    }
 
    //打WAR包的配置
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(ExampleApplication.class);
    }
 
    @Bean
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
 
}