It's no secret that George Lucas turned to Akira Kurosawa's films for inspiration when creating the Jedi for the Star Wars franchise, so there's a close connection between the galaxy's peacekeepers and samurai. However, the fact that these directors' understanding of samurai philosophy, or Bushido, can be traced back to one writer -- Inazo Nitobe -- and his 1899 book, Bushido: The Soul of Japan, is often overlooked and needs to be recognized. Bushido, at least through Nitobe's interpretation, can be broken down into seven main facets, and the tenets of the Jedi Code mirror their teachings.
Source:https://www.cbr.com/jedi-code-connection-bushido/