小编Ama*_*har的帖子

IntelliJ Idea:在合并时禁用自动提交

我想在Branch分割合并Branch时从Intellij Idea 上的Merge上禁用自动提交,如下所示.

在此输入图像描述

我知道如果我们使用Merge Branch Dialog,我可以选择No Commit.

在此输入图像描述

当我branch从Branch View对话框合并时,我可以在合并时禁用自动提交吗?

git merge intellij-idea

17
推荐指数
2
解决办法
2620
查看次数

docker volume自定义挂载点

我是Docker的新手,我正在玩弄docker volume.我想指定docker volume存储数据的位置.就像-v我们执行时提供选项一样docker run.Ex : -v /somefolder/:/var/somefolder

我们如何在创建时设置自定义Mountpointdocker volume.我没有在docs上找到任何选项.

当我检查音量时

[                                                                                        
    {                                                                                    
        "Name": "sampleproject_mysql_data",                                              
        "Driver": "local",                                                               
        "Mountpoint": "/mnt/sda1/var/lib/docker/volumes/sampleproject_mysql_data/_data", 
        "Labels": null,                                                                  
        "Scope": "local"                                                                 
    }                                                                                    
]   
Run Code Online (Sandbox Code Playgroud)

我得到了类似的东西.

有没有办法我们可以设置自定义Mountpoint.通过docker volume命令还是通过docker-compose.yml

docker docker-compose

15
推荐指数
1
解决办法
2万
查看次数

Spring Boot + Angular 2结构

在我的项目中,我想使用Spring BootAngular 2.

  1. 结构Spring Boot AppSpring Initializer完成 .
  2. 结构Angular 2 AppAngular CLI工具(ng new myfrontendapp)完成

Angular 1你可以把你index.html变成公共文件夹中.

Angular 2index.html中生成src文件夹,我想保持这种结构.

我的问题是我应该怎么做才能index.html看到Spring Boot并保持生成的结构Angular CLI.

谢谢你的回答.

spring-boot angular-cli angular

11
推荐指数
1
解决办法
3038
查看次数

@Converter(autoApply = true) 不起作用

@Converter即使autoApply = true添加也不会应用。当作品@Convert被添加到域本身。

这是一个代码 Converter

package com.example.hibernate.model;

@Converter(autoApply = true)
public class HeightConverter implements AttributeConverter<Height, Integer> {
    public Integer convertToDatabaseColumn(Height height) {//convert}
    public Height convertToEntityAttribute(Integer dbData) {//convert}
}
Run Code Online (Sandbox Code Playgroud)

类,其中Height使用

package com.example.hibernate.model;

@Entity
@Table(name = "student")
public class Student implements Serializable {
    @Id
    @GeneratedValue(generator = "MY_S")
    private int id;

    // works if @Convert is applied
    // @Convert( converter = HeightConverter.class, disableConversion = false )

    @Column(name = "height_in_cm")
    private Height height;

    //getter setter

}
Run Code Online (Sandbox Code Playgroud)

我正在使用 …

java hibernate jpa

8
推荐指数
3
解决办法
8028
查看次数

java:如何为变量自动生成自定义方法

我有一种情况,我想为我的领域定义各种行为.

class SomePage {
    //...

    @FindBy(id = "selectEthinicity")
    private WebElement ethinicitySelect;

    @FindBy(id = "someId")
    private WebElement usernameInputField;

     @FindBy(id = "buttonSubmit")
    private WebElement submitButton;


    public void selectEthnicity(String param) throws Exception {
        new Select(ethnicitySelect).selectByVisibleText(param);
    }

    public void selectEthnicityByIndex(String param) throws Exception {
        new Select(ethnicitySelect).selectByIndex(Integer.parseInt(param));
    }

    public int getSelectEthinicityNumberOfOptions() {
        new Select(ethnicitySelect).getOptions().size();    
    }

    public void waitForOptionOfSelectEthnicityToLoad() {
       //logic to wait for an options of Ethinicity to load
    }

    public void selectEthnicity_Wait(String param) throws Exception {
        //wait 
        //select Ethinicity
    }

    public void selectEthnicityByIndex_Wait(String param) …
Run Code Online (Sandbox Code Playgroud)

java intellij-idea getter-setter

6
推荐指数
1
解决办法
1014
查看次数

IntelliJ 无法识别 JPA 静态元模型

我使用 JHipster 和 Gradle 作为构建工具生成了应用程序。

当我创建实体时,我添加了过滤支持,从而生成了 JPA 静态元模型。但是 IntelliJ 无法识别元模型。

我在 IntelliJ 上启用了注释处理器设置,但它似乎不起作用。

我必须更改哪些设置才能让 IntelliJ 识别 JPA 静态元模型?

jpa intellij-idea metamodel jpa-2.0 jhipster

6
推荐指数
3
解决办法
1万
查看次数

Github Pages显示未来日期的帖子

我有很多帖子_posts.帖子文件有如下图案

??? _posts
?   ??? 2016-10-02-SomeContent.md
?   ??? 2016-10-03-AnotherContent.md
Run Code Online (Sandbox Code Playgroud)

在我的本地机器上(ubuntu 16.04 LTS)如果我在我的post file名字前面添加了future date类似2017-10-03-FutureContent.md未来日期前缀的帖子,则不会显示.

我正在使用bundle exec jekyll serve该项目

但是当我把它推到Github可见的位置并将发布日期显示为未来日期时.

使用这个主题

为什么我不能在我的本地机器上看到帖子,但是当它被推送到Github时它是可见的?

github jekyll

5
推荐指数
1
解决办法
284
查看次数

使用单个请求发送 JSON 和图像。角 + 弹簧靴

弹簧座控制器

@PostMapping(
    value = "/post",
    produces = MediaType.APPLICATION_JSON_VALUE,
    consumes = {MediaType.APPLICATION_JSON_VALUE, MediaType.MULTIPART_FORM_DATA_VALUE}
)
public ResponseEntity<User> handleFileUpload(@RequestParam("user") User user, @RequestPart("file") MultipartFile file) {
    // do something with User and file
    return ResponseEntity.ok().build();
}
Run Code Online (Sandbox Code Playgroud)

角度服务

@Injectable()
export class UploadFileService {

  constructor(private http: HttpClient) { }
  pushFileToStorage(file: File): Observable<HttpEvent<{}>> {
    let formdata: FormData = new FormData();
    formdata.append('file', file);
    formdata.append('user', JSON.stringify(new User('John', 12)))

    const req = new HttpRequest('POST', '/post', formdata, {
      reportProgress: true,
    });

    return this.http.request(req);
  }
}
Run Code Online (Sandbox Code Playgroud)

当我尝试发送请求时,我得到 500 Internal Server Error.

这是一个请求头 …

spring typescript spring-boot angular

5
推荐指数
1
解决办法
9552
查看次数

Koitlin对JPA静态元模型的支持

当我Entity使用Java JPA 创建类时,会生成静态元模型。

如果我将实体转换为Kotlin JPA,则不会生成静态元模型。

如何解决这个问题呢?

编辑

我正在使用Gradle作为构建工具。

metamodel kotlin jpa-2.1

5
推荐指数
2
解决办法
816
查看次数

Hibernate 5.1.x命名策略(与Hibernate 4.x向后兼容)

我正在使用Spring Boot 1.3.3.RELEASE。默认情况下,Spring Boot使用Hibernate Version4.x。我正在尝试使用新的Hibernate,即5.1.0 FINAL(截至目前)。

我正在使用Gradle,以便覆盖Hibernate版本,所以我添加了以下行

ext['hibernate.version']="5.1.0.Final"
Run Code Online (Sandbox Code Playgroud)

遵循SpringBoot 1.3.0的步骤支持休眠5?

我正在使用以下方法命名策略

spring.jpa.properties.hibernate.naming.implicit-strategy: org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl

spring.jpa.properties.hibernate.naming.physical_strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
Run Code Online (Sandbox Code Playgroud)

我有一个实体课

@Entity
public class AppUser {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @NotNull
    @Length(max = 100)
    private String username;

    @NotNull
    @Length(max = 100)
    private String firstName;

    @NotNull
    @Length(max = 100)
    private String lastName;

    @Length(max = 100)
    private String middleName;

    @NotNull
    @Length(max=100)
    private String email;

    @NotNull
    @Length(max = 100)
    private String password;

    @NotNull
    private boolean enabled;

}
Run Code Online (Sandbox Code Playgroud)

在Hibernate 4.x上,它执行查询

create table app_user …
Run Code Online (Sandbox Code Playgroud)

java orm hibernate spring-data-jpa spring-boot

4
推荐指数
1
解决办法
6235
查看次数