springboot第三⽅jar包外部引⽤
⼀开始的时候,使⽤maven打包springboot,我都是将打好的包lib⾥⾯的jar全部删除。然后单独复制⼀份lib⽂件,然后运⾏的时候使⽤java -dirs=D:\lib test
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>mysql的jar包下载
<archive>
<manifest>
<!-- 指定 Spring Boot 启动类,实际测试中必须 -->
<mainClass>com.hch.fifa.FifaApplication</mainClass>
<!-- 将所有第三⽅ jar 添加到项⽬ jar 的 MANIFEST.MF ⽂件中,这样运⾏ jar 时依赖包才能被加载 -->
<addClasspath>true</addClasspath>
<!-- 指定复制第三⽅ jar 的⽬标⽬录为 target/lib/-->
<classpathPrefix>./lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!-- repackage 时排除掉第三⽅依赖 jar ⽂件,我们的可运⾏ Spring Boot 的 jar ⽂件瞬间变⼩ ^_^ -->
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<includes>
<include>
<groupId>nothing</groupId>
<artifactId>nothing</artifactId>
</include>
</includes>
</configuration>
</plugin>
这样运⾏的时候直接打命令
java test
然后再放上我的l
spring:
profiles:
active: dev
srping:
thymeleaf:
prefix: classpath:/templates/
mybatis:
typeAliasesPackage: ct.entity
mapperLocations: classpath:/mapper/*.xml
---
#开发配置
spring:
profiles: dev
profiles: dev
datasource:
url: jdbc:mysql://localhost:3306/fifa?useSSL=false
username: root
password: 123456
driver-class-name: sql.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
initialSize: 5
minIdle: 5
maxActive: 20
maxWait: 60000
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
thymeleaf:
encoding: UTF-8
mode: HTML
servlet:
content-type: text/html
cache: false
servlet:
multipart:
max-file-size: 100MB
max-request-size: 5000MB
server:
port: 61193
properties:
uplaodFilePath: /usr/local/upload/
version: 1.0
staticResourcesPath: /Users/workspaces/fifa/src/main/resources/static/ ---
#⽣产
spring:
profiles: pro
datasource:
url: jdbc:mysql://localhost:63306/fifa?useSSL=false
username: root
password: Zz.123.123
driver-class-name: sql.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
initialSize: 5
minIdle: 5
maxActive: 20
maxWait: 60000
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
encoding: UTF-8
mode: HTML
servlet:
content-type: text/html
cache: true
servlet:
multipart:
max-file-size: 100MB
max-request-size: 5000MB
max-request-size: 5000MB
server:
port: 61193
properties:
uplaodFilePath: /usr/local/upload/
version: 1.0
staticResourcesPath: /usr/local/fifa/static/
配置那个active: dev或者pro就可以指定不同配置
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论