Spring

windows环境 springboot+docker开发环境搭建与hello word

流过昼夜 提交于 2021-02-17 06:23:12
1,下载安装 docker toolbox 下载地址: http://mirrors.aliyun.com/docker-toolbox/windows/docker-toolbox/ docker toolbox 是一个工具集,它主要包含以下一些内容: Docker CLI 客户端,用来运行docker引擎创建镜像和容器 Docker Machine. 可以让你在windows的命令行中运行docker引擎命令 Docker Compose. 用来运行docker - compose命令 Kitematic. 这是Docker的GUI版本 Docker QuickStart shell. 这是一个已经配置好Docker的命令行环境 Oracle VM Virtualbox. 虚拟机 下载完成之后直接点击安装,安装成功后,桌边会出现三个图标,入下图所示: 点击 Docker QuickStart 图标来启动 Docker Toolbox 终端。 boot2docker用户和密码 用户 密码 进入方式 docker tcuser ssh root command:sudo -i (docker用户下执行) 配置中国版加速器 在当前用户文档下面有一个.docker文件夹中machine\machines\default下的config.json文件 修改配置文件"HostOptions

how to run/turn off selective tests based on profiles in spring boot

痴心易碎 提交于 2021-02-17 05:16:12
问题 I have a spring-boot application for which I am writing IT tests. The data for the tests comes from application-dev.properties when I activate dev profile Here is what I have for tests: @RunWith(SpringRunner.class) @SpringBootTest @WebAppConfiguration public class ApplicationTests { @Autowired Environment env; @Test public void contextLoads() { System.out.println(Arrays.toString((env.getActiveProfiles()))); } } ServiceITTest public class ServiceITTest extends ApplicationTests { @value String

how to run/turn off selective tests based on profiles in spring boot

走远了吗. 提交于 2021-02-17 05:16:06
问题 I have a spring-boot application for which I am writing IT tests. The data for the tests comes from application-dev.properties when I activate dev profile Here is what I have for tests: @RunWith(SpringRunner.class) @SpringBootTest @WebAppConfiguration public class ApplicationTests { @Autowired Environment env; @Test public void contextLoads() { System.out.println(Arrays.toString((env.getActiveProfiles()))); } } ServiceITTest public class ServiceITTest extends ApplicationTests { @value String

JavaFX & Spring Boot - NPE

血红的双手。 提交于 2021-02-17 04:53:45
问题 I'm still fighting with my issue. I want to use Spring Framework in order to incject dependencies and I have to use Spring boot to integrate both. Unfortunately, in first view autowiring is run correctly, but if I go next Stage, I got still only Null Pointer Exception . Thats main class: @SpringBootApplication(scanBasePackages = "boxingchallenge") public class BoxingChallengeApplication extends Application { public ConfigurableApplicationContext springContext; private Parent root; public

How to map sql native query result into DTO in spring jpa repository?

穿精又带淫゛_ 提交于 2021-02-17 04:46:33
问题 Hi what I am trying to achieve is to get SQL native query result map into my DTO in java spring jpa repository, how do I do this properly? I try several code, but it does not work, here is what I tried: First try : @Repository public interface StockRepository extends RevisionRepository<Stock, Long, Integer>, JpaRepository<Stock, Long> { @Query(value = "SELECT stock_akhir.product_id AS productId, stock_akhir.product_code AS productCode, SUM(stock_akhir.qty) as stockAkhir " + "FROM book_stock

因未发项目奖金,一名程序员决定删代码泄愤

不问归期 提交于 2021-02-17 04:05:46
长按识别上方二维码,关注公众号: 后端面试那些事 回复“ 报告 ”,获取你的GitHub年度报告! 作者 | 刘琳 来源 | 刘琳 你永远都想不到程序员会因为什么删掉代码。 你可能还记得年初微盟员工凭一己之力,删除自家公司数据库,累计市值蒸发超 30 亿港元的事情。 不仅如此,微盟服务器故障时间长达 8 天之久,最终赔付了商家 1.5 个亿,事后当事人自供是因酒后因生活不如意、无力偿还网贷等个人原因删库。 原本以为这理由已经够奇葩了。 近日,雷锋网编辑发现了一个更奇葩的删库理由:因公司未发奖金,一名程序员怒而修改华为云 obs 对象存储服务代码,导致平台大范围崩溃。 而这位“一时冲动”的程序员也收获了 5 个月的刑期。 看到这里,网友也忍不住吐槽道: 兄弟,不讲武德,付出代价了吧~ 1、 得不到奖励,不如就亲手毁灭 事情还要从今年 4 月份说起。 被告人王某(以下简称:王某)所在的公司项目是一个同城生活服务平台,主要是满足晋城消费者线上、线下的吃、喝、玩、乐、购服务。 2020 年 3 月 22 日,该公司某平台被晋城市商务局选为晋城市同城生活服务平台,受晋城市商务局委托向消费者发放电子消费劵。 2019 年 12 月,时任公司技术部的刘经理交给王某一个任务:开发 obs 代码,如果开发成功公司会有奖励。 在开发过程中王某负责写代码,另一位同事则负责做前段代码工作

Uniqueness of Session ID in a Distributed environment?

一世执手 提交于 2021-02-17 03:35:12
问题 We are using Spring Session (backed up with pivotal Gemfire) for our Spring Boot applications running in an Distributed environment. In such a distributed environment, does Spring Session ensure that a unique session id is used for new sessions being created across different JVMs ? 回答1: Just reviewing old SO posts for Spring Session Pivotal GemFire support, so my apologies your question never got answered in a timely manner. In a nutshell, Spring Session uses the UUID class to generate

Spring boot Ambiguous handler

元气小坏坏 提交于 2021-02-17 03:22:30
问题 I use Spring Boot. I created theses two method: @RequestMapping(value = "/user/{userId}", method = RequestMethod.GET) public UserAppDto getNameByUserId(@PathVariable("userId") Long userId) { return userService.getByUserId(userId); } @RequestMapping(value = "/user/{username}", method = RequestMethod.GET) public UserAppDto getNameByUsername(@PathVariable("username") String username) { return userService.getNameByUsername(username); } When i try to log in the web application, i get: java.lang

Lombok 作者因兼容问题讨伐 IntelliJ IDEA(官方已妥协)

百般思念 提交于 2021-02-17 03:00:38
今天(08/26),你看到本文应该是昨天了。 栈长上班打开电脑,按往常一样打开 IntelliJ IDEA 正准备撸码,突然收到 IDEA 2020.2.1 的更新提醒: 我现在用的还是 2020.1 版本: 前段时间,IDEA 2020.2 也发布了,我也收到了更新提醒,但每次我都 X 掉。 因为每次发新版本就会有一个问题,也一直影响着大家升级,那就是粉丝普遍反馈的 Lombok 等插件不兼容的问题,没办法,我们也用了 这个插件 ,轻量使用而已。 这次再点 IDEA 2020.2.1 进去看: 还是说不兼容 Lombok ,到底是什么鬼? 再注意看最上面的更新说明,IDEA 2020.2.1 修复了一些 bug,第一个就是关于 Lombok 的: The Lombok plugin now works as expected without getting blocked by exceptions. 再点击链接进去看: https://youtrack.jetbrains.com/issue/IDEA-248146 我看了下,是 Lombok 插件原作者两周前发的请求支持的贴子,关于 IntelliJ IDEA 2020.2 不兼容他的插件的问题,想寻求 IntelliJ IDEA 开发者的支持。 下面是评论: 栈长来解读下他们的留言: Wojciech Musiał:

从Unauthorized 401错误学习Spring Boot的Actuator

我的梦境 提交于 2021-02-17 02:41:09
之前用Spring Boot都是别人搭好的框架,然后自己在里面写就行了。对原理、细节上都怎么涉及,毕竟需求都做不完。但是昨天一个访问RESTful接口的401问题搞了我2个小时。网上找的很多用: 1 managements.security.enabled= false 并且添加一个actxxx包的方法对我也不管用,因为项目里面已经配置了这个。但是我还是遇到了401的这个问题。不死心继续搜,然后加入了这个配置就好了: 1 security.ignored= /* * 解决这个问题居然花了我两个小时,还是到处去找,不懂Spring Boot框架的原理,比如安全方面的,除了问题两眼一抹黑。 目标:弄清Spring Boot整体框架和框架中每个小块的基本知识。 Features Create stand-alone Spring applications Embed Tomcat, Jetty or Undertow directly (no need to deploy WAR files) Provide opinionated 'starter' dependencies to simplify your build configuration Automatically configure Spring and 3rd party libraries whenever