Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
shop
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
曲欣亮
shop
Commits
7af640e7
Commit
7af640e7
authored
Feb 14, 2023
by
张永
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
11
parent
befc2d8f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
8 deletions
+26
-8
pom.xml
pom.xml
+8
-2
ShopApplication.java
src/main/java/com/egolm/shop/ShopApplication.java
+18
-6
No files found.
pom.xml
View file @
7af640e7
...
...
@@ -10,7 +10,7 @@
<properties>
<start-class>
com.egolm.shop.ShopApplication
</start-class>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<project.reporting.outputEncoding>
UTF-8
</project.reporting.outputEncoding>
<project.reporting.outputEncoding>
UTF-8
</project.reporting.outputEncoding>
</properties>
<parent>
...
...
@@ -109,6 +109,11 @@
<artifactId>
spring-boot-devtools
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.security
</groupId>
...
...
@@ -123,9 +128,10 @@
<artifactId>
druid-spring-boot-starter
</artifactId>
<version>
1.1.20
</version>
</dependency>
<dependency>
<dependency>
<groupId>
com.microsoft.sqlserver
</groupId>
<artifactId>
mssql-jdbc
</artifactId>
<version>
9.4.0.jre8
</version>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
...
...
src/main/java/com/egolm/shop/ShopApplication.java
View file @
7af640e7
package
com
.
egolm
.
shop
;
import
java.util.TimeZone
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
;
import
org.springframework.cache.annotation.EnableCaching
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
@EnableAsync
(
proxyTargetClass
=
true
)
...
...
@@ -17,15 +23,22 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@SpringBootApplication
@EnableTransactionManagement
public
class
ShopApplication
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ShopApplication
.
class
);
private
static
ApplicationContext
applicationContext
;
public
static
void
main
(
String
[]
args
)
{
System
.
setProperty
(
"java.io.tmpdir"
,
"temp"
);
applicationContext
=
SpringApplication
.
run
(
ShopApplication
.
class
,
args
);
try
{
System
.
setProperty
(
"java.io.tmpdir"
,
"temp"
);
}
catch
(
Exception
e
)
{
logger
.
info
(
"docker 容器中运行。。。。"
);
System
.
setProperty
(
"java.io.tmpdir"
,
"/data/temp"
);
//容器内使用这种
}
finally
{
TimeZone
.
setDefault
(
TimeZone
.
getTimeZone
(
"GMT+8"
));
applicationContext
=
SpringApplication
.
run
(
ApplicationContext
.
class
,
args
);
}
}
public
static
ApplicationContext
getApplicationContext
()
{
public
static
ApplicationContext
getApplicationContext
()
{
return
applicationContext
;
}
...
...
@@ -37,9 +50,8 @@ public class ShopApplication {
public
static
<
T
>
T
getBean
(
Class
<
T
>
clazz
){
return
getApplicationContext
().
getBean
(
clazz
);
}
public
static
<
T
>
T
getBean
(
String
name
,
Class
<
T
>
clazz
){
return
getApplicationContext
().
getBean
(
name
,
clazz
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment