小编Ian*_*Lim的帖子

@RequiredArgsConstructor(onConstructor=@__(@Inject)) 上的 Javadoc 错误

我正在尝试使用 JDK 8 为一堆使用 lombok 的代码生成 javadoc。

我收到以下错误:

error: cannot find symbol
[ERROR] @RequiredArgsConstructor(onConstructor=@__(@Inject))
[ERROR] ^
[ERROR] symbol: class __
Run Code Online (Sandbox Code Playgroud)

关于如何解决上述错误的任何建议将不胜感激。

更新:使用如下配置的 maven javadoc 插件发生错误:

        <plugin>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.10.3</version>
            <!--
            <configuration>
                <doclet>ch.raffael.doclets.pegdown.PegdownDoclet</doclet>
                <docletArtifact>
                    <groupId>ch.raffael.pegdown-doclet</groupId>
                    <artifactId>pegdown-doclet</artifactId>
                    <version>1.1.1</version>
                </docletArtifact>
                <useStandardDocletOptions>true</useStandardDocletOptions>
            </configuration>
            -->
        </plugin>
Run Code Online (Sandbox Code Playgroud)

java lombok

7
推荐指数
1
解决办法
6734
查看次数

JsonMappingException:没有为类型找到合适的构造函数 - 用于外部对象

我有一个GeoJsonPoint从spring框架调用的对象,它在我的集成测试中不能被jackson mapper反序列化.另外,我无法添加虚拟构造函数,因为它是一个外部对象.所以我被困住了.这是我的主要实体;

@Document(collection = "foodTrucks")
@JsonSerialize(include = JsonSerialize.Inclusion.NON_EMPTY)
public class FoodTruckEntity {

    @Id
    private ObjectId id;

    private String applicant;
    private Status status;
    private String[] foodItems;
    private Double longitude;
    private Double latitude;
    private GeoJsonPoint geoJsonPoint;

    public FoodTruckEntity() {};

    // getters and setters
}
Run Code Online (Sandbox Code Playgroud)

而且测试

@Test
public void test() {
    ClientConfig clientConfig = new DefaultClientConfig();
    clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
    Client client = Client.create(clientConfig);

    String getNearFoodTrucksUrl = "http://localhost:8080/food-truck/near-locations/longitude/-122.398658184604/latitude/37.7901490737255/findAll";
    WebResource webResource = client.resource(getNearFoodTrucksUrl);
    ClientResponse response = webResource.get(ClientResponse.class);
    GeoResults<FoodTruckEntity> geoResults = webResource.get(new GenericType<GeoResults<FoodTruckEntity>>(){});

    if (response.getStatus() …
Run Code Online (Sandbox Code Playgroud)

java json jersey jackson

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

在 Spring Boot/Framework 中创建一个新的组件实例

在我基于 Spring Boot 的应用程序中,我有一个 @Component 类,它的代码类似于:

ExecutorService executorService = Executors.newFixedThreadPool(poolSize);

// Start a separate thread for each entry
Map<Long, Future<Integer>> calls = new HashMap<>();

for (MyClass info : list) {
    Callable<Integer> callable = new TableProcessor(info);
    Future<Integer> future = executorService.submit(callable);
    calls.put(info.getId(), future);
}
Run Code Online (Sandbox Code Playgroud)

AutoWiring 在 TableProcessor 类中不起作用,因为(我认为)我正在使用“new”创建一个实例。“为列表中的每个条目创建一个新实例”的最佳方法是什么?

注意:在这种情况下,将“Bean”添加到 Application 类将不起作用,因为我想要每个线程都有一个新实例。

spring dependency-injection spring-mvc spring-boot

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

@RequestMapping正则表达式

我正在尝试为spring @RequestMapping注释创建值属性,以便像这样映射url

/educationDistrict/308/action/resetAddressesForYear/1
Run Code Online (Sandbox Code Playgroud)

还有这个

/educationDistrict/308/action/resetAddressesForYear
Run Code Online (Sandbox Code Playgroud)

我有这个

@RequestMapping(value = "/{repository}/{id}/action/{methodName:[A-z]*}{v:.*}", method = RequestMethod.POST)
Run Code Online (Sandbox Code Playgroud)

但第一个网址不匹配.

我不能使用多重值因为春天hateoas https://github.com/spring-projects/spring-hateoas/issues/186

春天4.1.5

spring spring-mvc

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

如果一个@Transactional注释方法在同一对象实例上调用另一个@Transactional注释方法会发生什么?

我正在研究如何Spring处理事务,我问如果一个带@Transactional注释的方法@Transactional在同一个对象实例上调用另一个带注释的方法会发生什么?

我知道事务传播默认级别是REQUIRED这样的,如果我有一个method1()带有该调用@Transactional实例的注释MyObjecta method2()(带注释@Transactional)的相同实例,我认为,在该REQUIRED级别之后,它是在由创建的同一事务上执行的method1().

这是我的推理是正确的还是我错过了什么?我不确定如果@Transactional在同一个实例上调用2个方法会发生什么.

这个怎么运作?

java spring spring-transactions

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