Closed jbiancot closed 2 years ago
Hi @mhalbritter, any help with this?
It seems you miss a proxy hint for javax.servlet.http.HttpServletRequest
, for some reason Spring native is not able to infer this one (Spring Boot 3 should be more clever for that kind of use case). For now, I would recommand to specify the missing hint manually, see related documentation.
Hey @jbiancot, the problems are those fields:
@Autowired
private HttpServletRequest httpServletRequest;
As a HttpServletRequest
is request scoped, Spring injects a request scoped proxy for the request, which is not detected by Spring native and it fails in native-image.
Please try moving the HttpServletRequest
field to parameters of the controller methods.
Hi there,
I got rid of the Autowired and the HttpServletRequest.
I defined on the method I need the header this way:
public ResponseEntity<?> addCompany(@RequestHeader("Authorization") String authorization, ...
That works perfect, I was able to Native compiled, and run it !!
I was not sure if I can keep my code, and "add into the hint", I am not familiar with these hints.
Thanks !
Keep going with the project: Spring Native, this is a game changer !
Hi, I can build and run without problems if I use a JVM, java -jar ...
I am building the project using my Mac Intel "macOS Monterey v12.5", using:
But when using Native, I am getting some errors, I don't know if it is because common names on some Beans? or else?
I have attach the entire project on a ZIP file I have attached 2 text files, one is the build, and the other is the run "errors" shown.
I'll appreciate any help, this is a game changer for me. InhyuckProjectJava17.zip build_native_error.txt nativeBuild.txt