Modify sonarqube analysis

This commit is contained in:
kimyonghwa
2019-04-17 10:57:10 +09:00
parent 73804c1189
commit 02a4b3b7ea
5 changed files with 13 additions and 16 deletions

View File

@@ -1,6 +1,7 @@
plugins {
id 'org.springframework.boot' version '2.1.4.RELEASE'
id 'java'
id "org.sonarqube" version "2.7"
}
apply plugin: 'io.spring.dependency-management'

View File

@@ -51,7 +51,7 @@ public class ExceptionAdvice {
@ExceptionHandler(AccessDeniedException.class)
@ResponseStatus(HttpStatus.UNAUTHORIZED)
public CommonResult AccessDeniedException(HttpServletRequest request, AccessDeniedException e) {
public CommonResult accessDeniedException(HttpServletRequest request, AccessDeniedException e) {
return responseService.getFailResult(Integer.valueOf(getMessage("accessDenied.code")), getMessage("accessDenied.msg"));
}

View File

@@ -1,6 +1,5 @@
package com.rest.api.config;
import lombok.extern.slf4j.Slf4j;
import net.rakugakibox.util.YamlResourceBundle;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.MessageSource;
@@ -14,7 +13,6 @@ import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
import org.springframework.web.servlet.i18n.SessionLocaleResolver;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
@Configuration
@@ -56,7 +54,7 @@ public class MessageConfiguration implements WebMvcConfigurer {
// locale 정보에 따라 다른 yml 파일을 읽도록 처리
private static class YamlMessageSource extends ResourceBundleMessageSource {
@Override
protected ResourceBundle doGetBundle(String basename, Locale locale) throws MissingResourceException {
protected ResourceBundle doGetBundle(String basename, Locale locale) {
return ResourceBundle.getBundle(basename, locale, YamlResourceBundle.Control.INSTANCE);
}
}

View File

@@ -1,8 +1,6 @@
package com.rest.api.config.security;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.web.access.AccessDeniedHandler;
import org.springframework.stereotype.Component;
@@ -17,8 +15,6 @@ import java.io.IOException;
@Component
public class CustomAccessDeniedHandler implements AccessDeniedHandler {
private static final Logger logger = LoggerFactory.getLogger(CustomAccessDeniedHandler.class);
@Override
public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException exception) throws IOException,
ServletException {

View File

@@ -9,6 +9,8 @@ import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class HelloController {
private static final String HELLO = "helloworld";
@Setter
@Getter
public static class Hello {
@@ -18,19 +20,19 @@ public class HelloController {
@GetMapping(value = "/helloworld/string")
@ResponseBody
public String helloworldString() {
return "helloworld";
return HELLO;
}
@GetMapping(value = "/helloworld/json")
@ResponseBody
public Hello helloworldJson() {
Hello hello = new Hello();
hello.message = "helloworld";
hello.message = HELLO;
return hello;
}
@GetMapping(value = "/helloworld/page")
public String helloworld() {
return "helloworld";
return HELLO;
}
}