|
|
@@ -2,6 +2,7 @@ package com.nju.edu.gitlab.service.impl;
|
|
|
|
|
|
import com.nju.edu.gitlab.service.api.GroupService;
|
|
|
import com.nju.edu.gitlab.service.vo.GitlabGroup;
|
|
|
+import com.nju.edu.gitlab.util.ApplicationProperties;
|
|
|
import com.nju.edu.gitlab.web.dto.GroupMemberDTO;
|
|
|
import org.gitlab4j.api.GitLabApi;
|
|
|
import org.gitlab4j.api.GitLabApiException;
|
|
|
@@ -16,15 +17,16 @@ import org.springframework.stereotype.Component;
|
|
|
public class GroupServiceImpl implements GroupService {
|
|
|
private final GitLabApi gitlabApi;
|
|
|
|
|
|
- @Value("${gitlab.host}")
|
|
|
- private String gitlabHost;
|
|
|
- @Value("${gitlab.token}")
|
|
|
- private String token;
|
|
|
+ private final String gitlabHost;
|
|
|
+ private final String token;
|
|
|
|
|
|
@Autowired
|
|
|
- public GroupServiceImpl() {
|
|
|
- this.gitlabApi = new GitLabApi(gitlabHost,token);
|
|
|
+ public GroupServiceImpl(ApplicationProperties properties) {
|
|
|
+ this.gitlabHost=properties.getHost();
|
|
|
+ this.token= properties.getToken();
|
|
|
+ this.gitlabApi = new GitLabApi(this.gitlabHost, this.token);
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
public synchronized GitlabGroup createGroup(String groupName) throws GitLabApiException {
|
|
|
Group group=gitlabApi.getGroupApi().addGroup(groupName,groupName);
|