spring 代码中,解决docker环境变量传递问题
1,docker变量 在docker中定义变量,使用echo $Value 能直接在命令行中显示, 这个使用spring可以直接注入到代码当中。 php中有方便的代码直接获得环境变量,但是java用起来就麻烦点。 直接使用spring的value就行了。 2,代码 比如一个spring的用户登录action。 里面用docker配置了一个默认的admin登录名称和密码。 在spring里面可以这样写: import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestC...