Skip to content

Commit

Permalink
Bug: redis 연결 테스트
Browse files Browse the repository at this point in the history
  • Loading branch information
nampongo committed Mar 16, 2024
1 parent 0f335a9 commit 74b2f0b
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ dependencies {
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'

implementation 'ch.qos.logback:logback-classic:1.2.3'

implementation 'org.springframework.boot:spring-boot-starter-validation:3.1.5'

implementation group: 'io.jsonwebtoken', name: 'jjwt-api', version: '0.11.5'
runtimeOnly group: 'io.jsonwebtoken', name: 'jjwt-impl', version: '0.11.5'
runtimeOnly group: 'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.11.5'

implementation 'org.slf4j:slf4j-logback:2.0.0'

testImplementation 'org.mockito:mockito-core:5.2.0'

implementation 'org.springframework.boot:spring-boot-starter-data-redis'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

@Component
@Getter
@PropertySource("application.yml")
@PropertySource("application-secret.yml")
public class RedisProperties {
@Value("${spring.data.redis.port}")
@Value("${custom.redis.port}")
private int port;
@Value("${spring.data.redis.host}")
@Value("${custom.redis.host}")
private String host;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.senity.waved.base.jwt.TokenDto;
import com.senity.waved.base.jwt.TokenProvider;
import com.senity.waved.base.redis.Redis;
import com.senity.waved.base.redis.RedisUtil;
import com.senity.waved.domain.member.entity.Member;
import com.senity.waved.domain.member.repository.MemberRepository;
Expand All @@ -18,6 +19,7 @@
import org.springframework.web.util.UriComponentsBuilder;

import java.io.IOException;
import java.util.Optional;

@Slf4j
@Component
Expand All @@ -40,11 +42,11 @@ public void onAuthenticationSuccess(HttpServletRequest request, HttpServletRespo
TokenDto token = new TokenDto(tokenProvider.createAccessToken(userEmail),
tokenProvider.createRefreshToken(userEmail), member.getHasInfo());

/* Optional<Redis> optionalRedis = redisUtil.findByEmail(userEmail);
Optional<Redis> optionalRedis = redisUtil.findByEmail(userEmail);
if (optionalRedis.isPresent()) {
redisUtil.deleteByEmail(userEmail);
}
redisUtil.save(userEmail, token.getRefreshToken());*/
redisUtil.save(userEmail, token.getRefreshToken());

String url = makeRedirectUrl(token.getAccessToken(), token.getRefreshToken(), token.getHasInfo());
response.sendRedirect(url);
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/log4jdbc.log4j2.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
log4jdbc.auto.load.popular.drivers=false
log4jdbc.drivers=com.mysql.cj.jdbc.Driver
10 changes: 10 additions & 0 deletions src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<configuration>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="CONSOLE" />
</root>
</configuration>

0 comments on commit 74b2f0b

Please sign in to comment.