<?xml version="1.0" encoding="UTF-8"?>
<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">
<parent>
<artifactId>proman</artifactId>
<groupId>com.upgrad.proman</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>proman-api</artifactId>
<dependencies>
<dependency>
<groupId>com.upgrad.proman</groupId>
<artifactId>proman-service</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.18</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.6.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.6.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.4.0</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<output>${project.build.directory}/generated-sources</output>
<language>spring</language>
<library>spring-boot</library>
<generateApis>false</generateApis>
<generateModels>true</generateModels>
<modelPackage>com.upgrad.proman.api.model</modelPackage>
<configOptions>
<java8>true</java8>
<sourceFolder>.</sourceFolder>
<dateLibrary>java8</dateLibrary>
</configOptions>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<dependencies>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.18</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-generators</artifactId>
<version>1.0.0-rc0</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>signup</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/endpoints/signup.json</inputSpec>
<language>spring</language>
</configuration>
</execution>
<execution>
<id>useradmin</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/endpoints/useradmin.json</inputSpec>
<language>spring</language>
</configuration>
</execution>
<execution>
<id>authentication</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/endpoints/authentication.json</inputSpec>
<language>spring</language>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
使应用程序可运行:
<build>
<defaultGoal>clean package</defaultGoal>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
</plugin>
</plugins>
</build>
更新starter类(请确保检查headless(false)
):
@SpringBootApplication
public class DesktopBootApplication {
public static void main(String[] args) {
// check for availability:
if (!Desktop.isDesktopSupported()) {
System.out.println("This app needs a desktop manager to run, exiting.");
System.exit(1);
}
new SpringApplicationBuilder(DesktopBootApplication.class).headless(false).run(args);
}
@EventListener(ApplicationReadyEvent.class)
public void openBrowserAfterStartup() throws IOException, URISyntaxException {
// open default browser after start:
Desktop.getDesktop().browse(new URI("http://localhost:8080"));
}
}
您可能需要添加一个shutdown选项来停止服务器。即。使用Actuator shutdown资源,您可以从页面中的JavaScript停止它。
@Configuration
public class DesktopConfiguration {
@Autowired
private ApplicationContext appContext;
// Add a tray icon to stop the app:
@Bean
public void openTrayIcon() throws Exception {
TrayIcon icon = new TrayIcon(new ImageIcon(this.getClass().getResource("/spring.png")).getImage());
icon.setImageAutoSize(true);
icon.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
System.out.println("Exiting app ...");
SystemTray.getSystemTray().remove(icon);
SpringApplication.exit(appContext);
}
});
SystemTray.getSystemTray().add(icon);
icon.displayMessage("Spring Boot", "Application started", MessageType.INFO);
}
}
#include <stdio.h> int main(void) { int *p = NULL; printf("hello world\n"); *p = 0; return 0; } 技巧 例子程序访问了一个空指针,所以程序会crash并产生core dump文件。用gdb调试core dump文件,通常用这个命令形式:“
和调用方法的位置:
我正在尝试做一个简单的kotlin dropwizard应用程序。 我关注了一些在线信息,包括这个 https://dev.to/tagmg/step-by-step-guide-to-building-web-api-with-kotlin-and-dropwizard 因此,经过一些修改后,我创建了一个带有build.gradle的应用程序。KT是这样的: 在我的应用程序中,我有这样的东西:
问题内容: 我有一个可执行文件和一个动态库(.so)。该库会导出一些符号,并且可执行文件会成功调用它。但是我想使库调用可执行文件的功能成为可能。我试图在可执行文件中执行以下操作: 和这个在图书馆: 但是当我调用可执行文件(以加载库)时,它返回error 。我该如何解决? 问题答案: 在Linux / ELF中,您可以将选项传递给链接器(在编译器驱动程序上),以便将可执行文件中的符号导出到共享库中。
我将一个jenkinsfile放到项目的根目录中,并希望为我的管道引入一个groovy文件并执行它。我能够实现这一点的唯一方法是创建一个单独的项目并使用文件加载器。fromGit命令。我想做
问题内容: 我想在加载Spring上下文后立即运行一些作业,但是我不知道该怎么做。 你有什么想法吗? 问题答案: 谢谢大家的答复。实际上,我错过了一个问题的细节,我想在加载应用程序上下文后立即运行Quartz Job。我尝试了解决方案stakfeman,但是在运行Quartz Jobs时遇到了一些问题。最后,我找到了解决方案:在Spring中使用Quartz,代码如下: 再次感谢您的帮助,如果问题