参考如下pom.xml的配置文件加入jvm启动参数。

<jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>

 

<build>
		<finalName>AutoEngine</finalName>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
				</configuration>
				<!-- mvn spring-boot:repackage -->
				<executions>
					<execution>
						<goals>
							<goal>repackage</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

强烈建议在springboot项目引入spring-boot-maven-plugin插件,该插件会对maven生成的jar包进行二次打包,打成一个fat-jar包之后我们就可以直接使用“java -jar xxx.jar”来运行服务了。

 

BTW:通过如下命令可以查看项目中jar包的依赖关系:

mvn dependency:tree

src/main/resources下引入logback日志配置文件:

<?xml version="1.0" encoding="UTF-8"?>

<configuration>

    <include resource="org/springframework/boot/logging/logback/base.xml"/>

</configuration>

 

 

 

 

GitHub 加速计划 / sp / spring-boot
39
7
下载
spring-projects/spring-boot: 是一个用于简化Spring应用开发的框架。适合用于需要快速开发企业级Java应用的项目。特点是可以提供自动配置、独立运行和内置的Tomcat服务器,简化Spring应用的构建和部署。
最近提交(Master分支:2 个月前 )
50f64f94 Prior to this commit, the `HttpMessageConverters` auto-configuration would pick up `HttpMessageConverter<?>` beans from the context and broadly apply them to both server and client converters setup. This can cause several types of problems. First, specific configurations only meant for server setup will also be applied to the client side. For example, the Actuator JSOn configuration is only meant to be applied to the server infrastructure. Also, picking up converters from the context does not convey whether such converters are meant to override the default ones or should be configured as custom, in addition to the defaults. For example, a bean extending `JacksonJsonHttpMessageConverter` can be both meant to override the default with `builder.withJsonConverter` or meant as an additional converter with `builder.addCustomConverter`. This commit ensures that the auto-configurations contribute `ClientHttpMessageConvertersCustomizer` and `ServerHttpMessageConvertersCustomizer` beans instead of converter beans directly. Applications can still contribute such beans and those will be used. Fixes gh-48310 7 小时前
c1e43750 Closes gh-48360 9 小时前
Logo

AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。

更多推荐