Когда я запускаю команду для проекта весенней загрузки:
mvn spring-boot: run
Код показывает сообщение об успешной сборке, и оно заканчивается.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.084 s
[INFO] Finished at: 2019-06-03T11:28:11+05:30
[INFO] Final Memory: 64M/899M
[INFO] ------------------------------------------------------------------------
Но я хочу отобразить рабочий код в браузере на http://localhost:8080. Приложение немедленно останавливается, вместо запуска веб-сервера, проект заканчивается.Нужны ли какие-либо изменения в коде для запуска на локальном хосте?
Вот мой класс OMSApplication.java
@EnableScheduling
@SpringBootApplication(exclude=DataSourceAutoConfiguration.class)
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class,
HibernateJpaAutoConfiguration.class, UserDetailsServiceAutoConfiguration.class})
@EnableEnvironmentJKS
public class OMSApplication extends SpringBootServletInitializer{
private static final Logger log = LoggerFactory
.getLogger(OMSApplication.class);
public static void main(String[] args) {
ApplicationContext applicationContext = SpringApplication.run(
OMSApplication.class, args);
log.info(" Application context created: {}" , applicationContext);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(OMSApplication.class);
}
}
А вот файл 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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example.mpms.services</groupId>
<artifactId>oms-services</artifactId>
<!-- <version>0.0.1-SNAPSHOT</version>-->
<packaging>war</packaging>
<name>oms-services</name>
<description>oms services</description>
<parent>
<groupId>com.example.mpms</groupId>
<artifactId>mpms-oms</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.0.0.RELEASE</version>
<configuration>
<skip>true</skip>
<!-- <systemPropertyVariables>
<APIE_PLATFORM>DEV</APIE_PLATFORM>
<APIE_REGION>US</APIE_REGION>
<APIE_ZONE>STL</APIE_ZONE>
</systemPropertyVariables> -->
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>${mvn-site-plugin-version}</version>
</plugin>
</plugins>
</build>
</project>
Я не включил здесь все зависимости, так как ониих много.
А вот класс контроллеров:
@RestController
public class OrderController {
private static final Logger LOGGER = LoggerFactory.getLogger(OrderController.class);
@Autowired
private KYCOrderService kycOrderService;
/**
* Health check URL for application via synapse.
*
* */
@GetMapping(value = "/health",produces = MediaType.TEXT_PLAIN_VALUE)
@ResponseBody
public ResponseEntity<String> healthCheck() {
String output = String.format("Heartbeat :%s", "Cumulus- Order Management Service: I'm healthy!");
LOGGER.info(output);
return new ResponseEntity<>(output,HttpStatus.OK);
}
@PostMapping(path="/oms/order/kyc", produces = {MediaType.APPLICATION_XML_VALUE, MediaType.APPLICATION_JSON_VALUE})
@ApiOperation(value = "Place an Offline KYC Order", notes = "Order is placed in central oms", response = OfflineKYCOrderResponse.class, tags={ "OfflineKYCOrderResponse", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OfflineKYCOrderResponse creation OK", response = OfflineKYCOrderResponse.class),
@ApiResponse(code = 201, message = "Created", response = OfflineKYCOrderResponse.class),
@ApiResponse(code = 400, message = "Bad Request", response = OfflineKYCOrderResponse.class),
@ApiResponse(code = 401, message = "Unauthorized", response = OfflineKYCOrderResponse.class),
@ApiResponse(code = 403, message = "Forbidden", response = OfflineKYCOrderResponse.class),
@ApiResponse(code = 404, message = "Not Found", response = OfflineKYCOrderResponse.class)
})
public OfflineKYCOrderResponse placeOfflineKycOrder(@ApiParam(value = "Details of order to be placed" ,required=true)@RequestBody OfflineKYCOrderRequest offlineKYCOrder) {
LOGGER.info("OfflineKYCOrderRequest: {}" , offlineKYCOrder);
OfflineKYCOrderResponse errorResponse = offlineKYCOrder.validateInput();
if (null != errorResponse) {
LOGGER.info("OfflineKYCOrderResponse: {}" , errorResponse);
return errorResponse;
}
ReasonCodes processStatusCode = ReasonCodes.OMS000;
OfflineKYCOrderResponse offlineKYCOrderResponse = new OfflineKYCOrderResponse();
try {
KYCOrder createdKYCOrder = kycOrderService.saveOrder(new KYCOrder(offlineKYCOrder));
offlineKYCOrderResponse.setOrderNumber(createdKYCOrder.getOrder().getOrderId());
} catch (Exception e) {
processStatusCode = ReasonCodes.OMS001;
LOGGER.error("Failed to store order.", e);
} finally {
offlineKYCOrderResponse.setReasonCode(processStatusCode.toString());
offlineKYCOrderResponse.setReasonDescription(processStatusCode.getDescription());
}
LOGGER.info("OfflineKYCOrderResponse: {}" , offlineKYCOrderResponse);
return offlineKYCOrderResponse;
}
}
Может кто-нибудь помочь решить проблему?