Skip to content

Commit 5f300ad

Browse files
committed
[FIX] refactoring using sonarlint
1 parent f9975fb commit 5f300ad

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

SpringBootAsync/src/main/java/com/example/config/AsyncConfig.java renamed to SpringBootAsync/src/main/java/com/example/java/config/AsyncConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.example.config;
1+
package com.example.java.config;
22

33
import org.springframework.context.annotation.Configuration;
44
import org.springframework.scheduling.annotation.AsyncConfigurerSupport;
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.example.service;
1+
package com.example.java.service;
22

33
import org.slf4j.Logger;
44
import org.slf4j.LoggerFactory;
@@ -11,13 +11,21 @@ public class BasicService {
1111
private static final Logger logger = LoggerFactory.getLogger(BasicService.class);
1212

1313
@Async
14-
public void onAsync() throws InterruptedException {
15-
Thread.sleep(1000);
14+
public void onAsync() {
15+
try {
16+
Thread.sleep(1000);
17+
} catch (InterruptedException e) {
18+
e.printStackTrace();
19+
}
1620
logger.info("onAsync");
1721
}
1822

19-
public void onSync() throws InterruptedException {
20-
Thread.sleep(1000);
23+
public void onSync() {
24+
try {
25+
Thread.sleep(1000);
26+
} catch (InterruptedException e) {
27+
e.printStackTrace();
28+
}
2129
logger.info("onSync");
2230
}
2331
}

SpringBootAsync/src/main/java/com/example/web/BasicController.java renamed to SpringBootAsync/src/main/java/com/example/java/web/BasicController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package com.example.web;
1+
package com.example.java.web;
22

3-
import com.example.service.BasicService;
3+
import com.example.java.service.BasicService;
44
import org.slf4j.Logger;
55
import org.slf4j.LoggerFactory;
66
import org.springframework.beans.factory.annotation.Autowired;

SpringBootAsync/src/test/java/com/example/SpringBootAsyncApplicationTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package com.example;
22

3-
import com.example.service.BasicService;
3+
import com.example.java.service.BasicService;
44
import org.junit.Test;
5-
import org.junit.rules.Stopwatch;
65
import org.junit.runner.RunWith;
76
import org.springframework.beans.factory.annotation.Autowired;
87
import org.springframework.boot.test.context.SpringBootTest;

0 commit comments

Comments
 (0)