-
Notifications
You must be signed in to change notification settings - Fork 181
Expand file tree
/
Copy pathWebApi.java
More file actions
45 lines (37 loc) · 1.59 KB
/
Copy pathWebApi.java
File metadata and controls
45 lines (37 loc) · 1.59 KB
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
package org.ohdsi.webapi;
import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.scheduling.annotation.EnableScheduling;
import jakarta.annotation.PostConstruct;
import java.util.TimeZone;
/**
* OHDSI WebAPI Spring Boot Application
*
* Supports both JAR and WAR deployment:
* - JAR: java -jar WebAPI.jar (embedded Tomcat)
* - WAR: Deploy to external servlet container (mvn package -Pwar)
*/
@EnableScheduling
@SpringBootApplication(exclude={HibernateJpaAutoConfiguration.class, ErrorMvcAutoConfiguration.class})
@EnableAspectJAutoProxy(proxyTargetClass = true)
public class WebApi extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(WebApi.class);
}
public static void main(final String[] args) throws Exception
{
TomcatURLStreamHandlerFactory.disable();
SpringApplication.run(WebApi.class, args);
}
@PostConstruct
public void init() {
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
}
}