使用命令运行的问题Spring-Boot应用程序

时间:2019-06-21 10:09:46

标签: spring-boot jpa

enter image description here我是春季靴子世界的新手。我在Linux服务器上运行spring boot项目时遇到问题。我知道我可以使用“ java -jar。\ target \ network-0.0.1-SNAPSHOT.jar”或“ mvn spring-boot:run”命令运行jar文件。但是,我不确定有什么区别,哪一个是完美的。每当我在本地计算机上运行java -jar。\ target \ network-0.0.1-SNAPSHOT.jar时,它就会给我'entityManagerFactory'BeanCreationException。但是,如果我在本地计算机上运行mvn spring-boot:run,它将起作用。

在我的pom.xml中,我添加了maven插件,并使可执行文件为true。而且我总是用“ mvn clean install”构建问题。在这里,我提供了pom.xml和任何application.properties文件。任何人都可以帮助我,我将很高兴

<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>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.2.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.neasy</groupId>
    <artifactId>network</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>
    <name>network</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>


        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <jjwt.version>0.7.0</jjwt.version>
        <spring-security-pac4j.version>2.1.1</spring-security-pac4j.version>
        <pac4j.version>1.9.4</pac4j.version>
    </properties>

    <repositories>
        <repository>
            <id>spring-releases</id>
            <url>https://repo.spring.io/libs-release</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.pac4j</groupId>
            <artifactId>spring-security-pac4j</artifactId>
            <version>${spring-security-pac4j.version}</version>
        </dependency>

        <dependency>
            <groupId>org.modelmapper</groupId>
            <artifactId>modelmapper</artifactId>
            <version>0.7.5</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
            <version>2.0.1.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>ma.glasnost.orika</groupId>
            <artifactId>orika-core</artifactId>
            <version>1.4.2</version><!-- or latest version -->
        </dependency>

        <dependency>
            <groupId>com.github.slugify</groupId>
            <artifactId>slugify</artifactId>
            <version>2.1.9</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api -->
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.4.0-b180830.0359</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <version>2.1.6.RELEASE</version>
            <optional>true</optional>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <executable>true</executable>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>build-info</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>

        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>static/</directory>
                <targetPath>static/</targetPath>
            </resource>
        </resources>
    </build>

</project>
server.port=8080
salt=12345678901234567890123456789012

neasy.server.domain=http://localhost:8080

# Connection url for the database "netgloo_blog"
spring.datasource.url = jdbc:mysql://remotemysql.com:3306/DLvQ1C47XL?useSSL=false&useLegacyDatetimeCode=false&serverTimezone=UTC
debug=true

# Username and password
spring.datasource.username = 
spring.datasource.password = 

# Hibernate ddl auto (create, create-drop, update): with "update" the database
# schema will be automatically updated accordingly to java entities found in
# the project
spring.jpa.hibernate.ddl-auto = update
spring.jmx.enabled=false

# Show or not log for each sql query
spring.jpa.show-sql = true
spring.devtools.restart.enabled=true

#LOGGING
#logging.path=/tmp/
#logging.file=neasy-log
#logging.level.com.neasy.network=ERROR
#logging.level.root = error

# THYMELEAF
spring.thymeleaf.cache=false

server.connection-timeout=-1

neasy.directory.upload=src/main/resources/static/uploads/

0 个答案:

没有答案