1010import org .inhahackers .optmo_user_be .exception .JwtAuthenticationException ;
1111import org .inhahackers .optmo_user_be .service .JwtTokenService ;
1212import org .inhahackers .optmo_user_be .service .UserService ;
13+ import org .springframework .context .ApplicationContext ;
14+ import org .springframework .context .annotation .AnnotationConfigApplicationContext ;
1315
1416import java .util .Optional ;
1517
1618@ RequiredArgsConstructor
1719public class UserFunction {
1820
19- private final JwtTokenService jwtTokenService ;
20- private final UserService userService ;
21+ private static final ApplicationContext context =
22+ new AnnotationConfigApplicationContext ( "org.inhahackers.optmo_user_be" ) ;
2123
2224 @ FunctionName ("userFunction" )
2325 public HttpResponseMessage run (
@@ -26,12 +28,15 @@ public HttpResponseMessage run(
2628 methods = {HttpMethod .POST },
2729 authLevel = AuthorizationLevel .ANONYMOUS )
2830 HttpRequestMessage <Void > request ,
29- final ExecutionContext context ) {
31+ final ExecutionContext executionContext ) {
3032
31- context .getLogger ().info ("Processing userFunction request" );
33+ executionContext .getLogger ().info ("Processing userFunction request" );
3234
3335 try {
3436 // 요청 바디 파싱
37+ JwtTokenService jwtTokenService = context .getBean (JwtTokenService .class );
38+ UserService userService = context .getBean (UserService .class );
39+
3540 String email = request .getQueryParameters ().get ("email" );
3641
3742 // 유저 정보 조회 및 생성
@@ -73,6 +78,7 @@ public HttpResponseMessage run(
7378 .build ();
7479
7580 } catch (Exception e ) {
81+ executionContext .getLogger ().severe ("ERROR: " + e .getMessage ());
7682 return request .createResponseBuilder (HttpStatus .INTERNAL_SERVER_ERROR )
7783 .body ("Internal error: " + e .getMessage ())
7884 .build ();
0 commit comments