Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[20211006] (Spring) InitializingBean, Disposable #216

Open
JuHyun419 opened this issue Oct 6, 2021 · 0 comments
Open

[20211006] (Spring) InitializingBean, Disposable #216

JuHyun419 opened this issue Oct 6, 2021 · 0 comments
Labels

Comments

@JuHyun419
Copy link
Owner

InitializingBean

  • InitializingBean 인터페이스 afterPropertiesSet() 메소드에 빈 객체 초기화 시 필요한 코드 구현

Disposable

  • Disposable 인터페이스 destory() 메소드에 빈 객체 소멸 시 필요한 코드 구현
// InitializingBean

public class TokenProvider implements InitializingBean {

    private final String secret;
    private Key key;

    public TokenProvider(
            @Value("${jwt.secret}") String secret) {
        this.secret = secret;
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        final byte[] kyeBytes = Decoders.BASE64.decode(secret);
        this.key = Keys.hmacShaKeyFor(kyeBytes);
    }

...

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant