小编try*_*ard的帖子

如何在 Intellij 中按字母顺序对导入进行排序?

是否可以强制 IntelliJ 按字母顺序对导入进行排序?因此,它应该按字典顺序添加导入,并在格式化代码时对所有顺序不正确的导入进行排序。

intellij-idea

23
推荐指数
2
解决办法
3万
查看次数

使用CLI将docker-compose部署到Azure时,在访问代理页面时会超时

我有docker-compose档案:

version: "3"
services:
  app2:
    image: kamilwit/dockerdocker_app2
    container_name: app2
    build:
      context: ./app2
    volumes:
      - app2data:/data
    environment:
      - LOGGING_LOG-FILES-PATH=/opt/tomcat/logs
    ports:
      - "8000:8080"
  app:
    image: kamilwit/dockerdocker_app
    container_name: app
    build:
      context: ./app
    volumes:
      - app1data:/data
    environment:
      - LOGGING_LOG-FILES-PATH=/opt/tomcat/logs
    ports:
      - "8001:8080"
volumes:
  app1data:
  app2data:
Run Code Online (Sandbox Code Playgroud)

我按照https://docs.microsoft.com/en-us/azure/container-service/dcos-swarm/container-service-swarm-walkthrough的说明进行操作

确切地说,我执行了以下命令:

az group create --name myResourceGroup --location westus

az acs create --name mySwarmCluster --orchestrator-type Swarm --resource-group myResourceGroup --generate-ssh-keys --agent-count 1
Run Code Online (Sandbox Code Playgroud)

然后我得到了output来自

az network public-ip list --resource-group myResourceGroup --query "[*].{Name:name,IPAddress:ipAddress}" -o table

Name …
Run Code Online (Sandbox Code Playgroud)

deployment azure docker docker-compose azure-container-service

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

更改文本的颜色以响应背景色

考虑以下示例: codepen

.infobox {
  width: 110mm;
  height: 65mm;
  background-image: url(https://i.pinimg.com/564x/86/70/f2/8670f2ab34bf4082bf3cef004aae0826.jpg);
  background-size: cover;
  position: relative;
}

.text {
  position: absolute;
  bottom: 0;
  text-align: center;
  color: white;
}
Run Code Online (Sandbox Code Playgroud)
<div class="infobox">
  <span class="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vel quam in enim pulvinar fringilla. Etiam molestie convallis pharetra. Sed et tortor tortor. Vestibulum ligula ex, rhoncus semper metus ut, hendrerit porttitor risus. Quisque at porta magna. Phasellus vel vulputate diam. Maecenas sem est, aliquet nec odio euismod, posuere luctus nisl. …
Run Code Online (Sandbox Code Playgroud)

html css

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

Graphql 没有为接口/联合定义解析器 - java

我在使用这种方法添加解析器时遇到问题graphql

@RestController
@RequestMapping("/api/dictionary/")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class DictionaryController {
    @Value("classpath:items.graphqls")
    private Resource schemaResource;
    private GraphQL graphQL;
    private final DictionaryService dictionaryService;

    @PostConstruct
    public void loadSchema() throws IOException {
        File schemaFile = schemaResource.getFile();
        TypeDefinitionRegistry registry = new SchemaParser().parse(schemaFile);
        RuntimeWiring wiring = buildWiring();
        GraphQLSchema schema = new SchemaGenerator().makeExecutableSchema(registry, wiring);
        graphQL = GraphQL.newGraphQL(schema).build();
    }

private RuntimeWiring buildWiring() {
    DataFetcher<List<DictionaryItemWithParentDto>> fetcher6 = dataFetchingEnvironment -> dictionaryService.getClaimSubType();

        return RuntimeWiring.newRuntimeWiring()
                .type("Query", typeWriting ->
                   typeWriting
                    .dataFetcher("getClaimSubType", fetcher6)
                    )
                .build();
    }


public List<DictionaryItemWithParentDto> getClaimSubType() {
    return dictionaryService.getClaimSubType(); …
Run Code Online (Sandbox Code Playgroud)

java graphql graphql-java

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

由于maven-surefire-plugin,Maven构建失败

我有类似的问题,在这里even缺少maven-surefire-plugin

但我做了那个问题的答案,但我的构建仍然失败并出现同样的错误.

MCVE这里:https://github.com/yami12376/AspectJ

当我建立我得到:

[WARNING] Error injecting: org.apache.maven.plugin.surefire.SurefirePlugin
java.lang.TypeNotPresentException: Type org.apache.maven.plugin.surefire.SurefirePlugin not present
        at 

    ...
org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
        ... 57 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.216 s
[INFO] Finished at: 2017-04-06T18:12:01+02:00
[INFO] Final Memory: 13M/244M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project NumberGenerator: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test failed: Unable to load the mojo 'test' in the plugin 'org.apache.maven.plugins:maven-surefire-plugin:2.12.4'. A required class is missing: org/apache/maven/plugin/surefire/SurefireReportParameters
[ERROR] ----------------------------------------------------- …
Run Code Online (Sandbox Code Playgroud)

java eclipse java-ee maven

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

Spring Boot 2 从 Spring Boot 1.5 迁移到 redis 问题

我需要更改 Redis 代码,以便它可以与新的 SpringBoot 2.0.3 一起使用,目前在启动 Tomcat 9.0.12 时(不是将 SpringBoot 作为 Jar 启动 - 业务需求的原因)我收到以下错误:

 ***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of method vehicleHistoryCacheManager in somePath.config.UfCacheConfig 
required a bean of type 'org.springframework.data.redis.connection.RedisConnectionFactory' that could not be found.
    - Bean method 'redisConnectionFactory' in 'JedisConnectionConfiguration' not loaded because @ConditionalOnMissingBean 
    (types: org.springframework.data.redis.connection.RedisConnectionFactory; SearchStrategy: all) 
    beans of type 'org.springframework.data.redis.connection.RedisConnectionFactory' redisConnectionFactory
    - Bean method 'redisConnectionFactory' in 'LettuceConnectionConfiguration' not loaded because @ConditionalOnMissingBean 
    (types: org.springframework.data.redis.connection.RedisConnectionFactory; SearchStrategy: all) 
    found beans of type 'org.springframework.data.redis.connection.RedisConnectionFactory' redisConnectionFactory


Action: …
Run Code Online (Sandbox Code Playgroud)

java spring tomcat redis spring-boot

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

RabbitMQ 控制台返回 431

我开始rabbitmq使用 docker 命令:

docker run -d --hostname my-rabbit --name rabbit-fox -p 5672:5672 -p 8090:15672 rabbitmq:3-management
Run Code Online (Sandbox Code Playgroud)

它运行良好,我可以登录控制台,但后来Chrome browser我得到了这个:

在此处输入图片说明

并且不能在浏览器中使用 then 控制台。

windows google-chrome rabbitmq docker

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

Jackson 解串器默认如何工作

我正在使用Spring-boot 2.1.6并且我有DTO

@AllArgsConstructor
@Builder
@Data // setters, getters, others
@NoArgsConstructor
public class ExampleDto {
    private String fieldOne;
    private String fieldsTwo;

}
Run Code Online (Sandbox Code Playgroud)

我真的需要那么多Lombok注释吗?通过连接(微服务)Jackson反序列化时默认使用哪个?HTTP我想只有NoArgsConstructor+setters就可以了?或者它使用reflection并且只提供 no-arg-constructor 就可以了?

是否可以选择更改Jackson仅使用AllArgsConstructor或的行为builder?我在日志中看到我的应用程序使用它Jackson来反序列化内容。

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-annotations</artifactId>
    <version>2.8.8</version>
    <scope>provided</scope>
</dependency>

 <dependency>
    <groupId>com.fasterxml.jackson.datatype</groupId>
    <artifactId>jackson-datatype-jdk8</artifactId>
</dependency>

<dependency>
    <groupId>com.fasterxml.jackson.datatype</groupId>
    <artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)

编辑:

我的问题与Can't make Jackson and Lombok work Together不同,因为它有效。

java jackson lombok deserialization spring-boot

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

Postgresql致命的数据库系统正在启动-Windows 10

我已经安装postgresqlwindows 10usb disk。每天,当我从工作中启动我的电脑sleep并再次插入磁盘,然后尝试启动时,postgresql都会出现此错误:

FATAL: the database system is starting up
Run Code Online (Sandbox Code Playgroud)

该服务从以下命令开始:

E:\PostgresSql\pg96\pgservice.exe "//RS//PostgreSQL 9.6 Server"
Run Code Online (Sandbox Code Playgroud)

它是默认值。

来自的日志 E:\PostgresSql\data\logs\pg96

2019-02-28 10:30:36 CET [21788]: [1-1] user=postgres,db=postgres,app=[unknown],client=::1 FATAL:  the database system is starting up
2019-02-28 10:31:08 CET [9796]: [1-1] user=postgres,db=postgres,app=[unknown],client=::1 FATAL:  the database system is starting up
Run Code Online (Sandbox Code Playgroud)

我希望启动速度更快。

postgresql

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

使用grapiql的GraphQl变量 - 变量未定义

我正在使用这个端点:

 @PostMapping("graphql")
    public ResponseEntity<Object> getResource(@RequestBody Object query) { // String query
        ExecutionResult result;
        if (query instanceof String) {
            result = graphQL.execute(query.toString()); // if plain text
        } else{
            String queryString = ((HashMap) query).get("query").toString();
            Object variables = ((HashMap) query).get("variables");
            ExecutionInput input = ExecutionInput.newExecutionInput()
                    .query(queryString)
                    .variables((Map<String, Object>) variables) // "var1" -> "test1"
                    .build();

            result = graphQL.execute(input);
        }
        return new ResponseEntity<Object>(result, HttpStatus.OK);
    }
Run Code Online (Sandbox Code Playgroud)

当我没有变量时它工作正常:

query {
    getItem(dictionaryType: "test1") {
        code
        name
        description
    }
}
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

当我添加variable它开始失败时,请参见此处:

query {
    getItem(dictionaryType: $var1) {
        code
        name …
Run Code Online (Sandbox Code Playgroud)

java graphql graphql-java graphiql

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

Spring @value 不设置属性

我有一个类,我想从属性文件中设置它的参数之一:

import org.springframework.beans.factory.annotation.Value;
(..)
@Getter
@Setter
@NoArgsConstructor
public class ConvertNonStandardOfferRequestDtoWrapper {
    private ConvertNonStandardOfferRequestDto convertNonStandardOfferRequestDto;

    @Value("true")
    private boolean documentPrintoutsRequired;

    public ConvertNonStandardOfferRequestDtoWrapper(ConvertNonStandardOfferRequestDto convertNonStandardOfferRequestDto) {
        this.convertNonStandardOfferRequestDto = convertNonStandardOfferRequestDto;
    }
}
Run Code Online (Sandbox Code Playgroud)

我里面的构造函数看到的是,documentPrintoutsRequiredfalse不是true。我在构造函数中调试和设置断点时看到了这一点。我有这个模块的 pom 文件:

    <modelVersion>4.0.0</modelVersion>    
    <parent>
        <groupId>x</groupId>
        <artifactId>policy</artifactId>
        <version>4.0-SNAPSHOT</version>
    </parent>

    <artifactId>policy-api</artifactId>

    <dependencies>
        <dependency>
            <groupId>x</groupId>
            <artifactId>common-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>${guava.version}</version>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
    </dependencies>
    <build>
        (...) …
Run Code Online (Sandbox Code Playgroud)

java spring spring-boot

0
推荐指数
1
解决办法
1939
查看次数