primordic/IssueDupesLite huggingface dataset:
Repository: spring-projects/spring-batch

Issue #3834: Documentation references a class that's deprecated in v4 and removed in v5: MapJobRepositoryFactoryBean
Created: 2021-01-21T09:19:12Z
https://docs.spring.io/spring-batch/docs/5.0.0-SNAPSHOT/reference/html/job.html#inMemoryRepository
references MapJobRepositoryFactoryBean which is deprecated in v4 and it's supposed to have been removed in v5.
Same documentation for v4 and current.

Duplicate issue #4016: documentation : example for in-memory repository, with no deprecated classes
Created: 2021-10-18T16:44:27Z
The current example provided in the documentation to run a job with an in-memory repository actually uses MapJobRepositoryFactoryBean, which is deprecated.
https://docs.spring.io/spring-batch/docs/current/reference/html/index-single.html#inMemoryRepository
It would be good to review the example and provide one that shows the "real" recommended way.. I guess it would be way to use an H2 datasource (ideally, programmatically) initialized with the proper tables so that it can be used directly

Closing comment (2021-12-16T13:23:31Z): This is similar to #3834, where I mentioned that the suggested replacement can be found in the Javadocs. There is also a first draft of a migration guide for v5.
But since this is a recurring request, I think the reference documentation should also be updated with a deprecation note and a sample.
Repository: spring-projects/spring-batch

Issue #4001: SqlSyntaxErrorException when creating table BATCH_JOB_EXECUTION with db2 v9
Created: 2021-09-13T13:22:00Z
Please do a quick search on Github issues first, there might be already a duplicate issue for the one you are about to create.
If the bug is trivial, just go ahead and create the issue. Otherwise, please take a few moments and fill in the following sections:
Bug description
An exception thrown when running the schema-db2.sql  script, while creating BATCH_JOB_EXECUTION table ...
SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=,;N VARCHAR(2500) null;<references_spec>....
In fact JOB_CONFIGURATION_LOCATION VARCHAR(2500) NULL, cause a problem.
Environment
Please provide as many details as possible: Spring Batch version, Java version, which database you use if any, etc
java 11
Spring Batch v4.3.1
DB2 v9.5.0.8
Steps to reproduce
Start a spring batch application that points the data source to a db2 database ...
Expected behavior
6 tables should be created :

BATCH_STEP_EXECUTION_CONTEXT
BATCH_JOB_EXECUTION_CONTEXT
BATCH_STEP_EXECUTION
BATCH_JOB_EXECUTION_PARAMS
BATCH_JOB_EXECUTION
BATCH_JOB_INSTANCE

Minimal Complete Reproducible example
Please provide a failing unit test or a minimal complete example that reproduces the issue.
Reports that are reproducible will take priority over reports that are not reproducible.

Duplicate issue #4000: Create table BATCH_JOB_EXECUTION throws SqlSyntaxErrorException with db2
Created: 2021-09-13T10:07:36Z
Expected Behavior
Create all the tables( 6 tables) found in the schema-db2.sql script.

Current Behavior
Create Only the first table and skip the creation of the 5 others, following an exception thrown when creating the table BATCH_JOB_EXECUTION
SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=,;N VARCHAR(2500) null;<references_spec>....
In fact	JOB_CONFIGURATION_LOCATION VARCHAR(2500) NULL, cause a problem.

Context
Here is the corrected script:
CREATE TABLE BATCH_JOB_EXECUTION  (
JOB_EXECUTION_ID BIGINT  NOT NULL PRIMARY KEY ,
VERSION BIGINT  ,
JOB_INSTANCE_ID BIGINT NOT NULL,
CREATE_TIME TIMESTAMP NOT NULL,
START_TIME TIMESTAMP DEFAULT NULL ,
END_TIME TIMESTAMP DEFAULT NULL ,
STATUS VARCHAR(10) ,
EXIT_CODE VARCHAR(2500) ,
EXIT_MESSAGE VARCHAR(2500) ,
LAST_UPDATED TIMESTAMP,
JOB_CONFIGURATION_LOCATION VARCHAR(2500) DEFAULT NULL,
constraint JOB_INST_EXEC_FK foreign key (JOB_INSTANCE_ID)
references BATCH_JOB_INSTANCE(JOB_INSTANCE_ID)
) ;

Closing comment (2021-09-13T17:21:10Z): Closing this as duplicate of #4001 .
Repository: spring-projects/spring-batch

Issue #2065: Pipelining: allow concurrent processing of dependent steps [BATCH-1517]
Created: 2010-02-27T00:04:52Z
Dave Syer opened BATCH-1517 and commented
Sometimes step2 can start processing the output from step1 before step1 has finished.  Declaring that this is possible would be a nice feature, and the framework would then have to take into account the status of step1 before deciding that step2 had completed or not.

1 votes, 1 watchers

Duplicate issue #2044: Allow dependent steps to start concurrently
Created: 2010-03-22T04:14:05Z
Dave Syer opened BATCH-1538 and commented
Allow dependent steps to start concurrently: step1 can be producing data that are needed in step2, e.g. staging records, and step2 can start to process those as soon as they are available without waiting.  All that is needed is a protocol for the steps to agree on whether a dependency is finished or in flight.  (In the staging case step1 is hardly ever a limiting factor in terms of execution time, but it might still help.)

1 votes, 3 watchers

Closing comment (2012-06-26T04:53:35Z): Giovanni Dall'Oglio Risso commented
Excuse me, but this issue seems very similar to #2065.
IMHO you can think at something like "spring integration channels", between two steps

First step

when a chunk commits, you push the data in a queue
*** you can insert the List writed by the ItemWriter, or to perform a sort of trasformation, defining a delegate


Second step

You use the data coming from the queue to substitute the IO-consuming ItemReader
you use the real ItemReader only in case of restart



There are some things to clarify (eg: how is managed the restart? How manage different chunk sizes?), but this way can be feasible.
At the moment, to save IO time, we overloaded one step:

ItemReader

a simple reader


ItemProcessor

a CompositeItemProcessor, with a long-list of processors, that do the operations of multiple steps, all together


ItemWriter

a CompositeItemWriter, that write everything (really a lot of things)
*** followed by a list of FilterItemWriter,
*** that delegates the real IO to other Writers



Obviously: this solution help to save IO time, but makes the things harder to understand and change. And this is a bad thing. More: this solution mantains the operations single-thread-sequential.
Your solution (a pipeline) is ways better: enable the developers to save IO time, design a cleaner jobs, and allow the processes to be broken into different threads (one for chunk).
Repository: spring-projects/spring-data-jpa

Issue #2294: Implement FluentQuery support for Querydsl and Query by Example
Created: 2021-09-09T15:07:15Z
Implement Spring Data Commons' FluentQuery support per spring-projects/spring-data-commons#2421.

Duplicate issue #2269: Add FluentQuery support to `QuerydslPredicateExecutor` and `QueryByExampleExecutor`
Created: 2021-07-29T13:28:28Z
Based on spring-projects/spring-data-commons#2421, we should add an implementation for the Fluent Query API through QuerydslPredicateExecutor and QueryByExampleExecutor. See also spring-projects/spring-data-commons#2228.

Closing comment (2021-10-08T12:07:51Z): Duplicate of #2294
Repository: spring-projects/spring-data-jpa

Issue #487: Support search result classes different from Specification query root [DATAJPA-51]
Created: 2011-04-13T06:52:34Z
Stevo Slavić opened DATAJPA-51 and commented
Currently Specification API does not support search to return anything other than instance of query root (or some collection of root) JPA entity as result. But JPA itself supports result to be different class from query root and it typically isn't an entity bean class (see here and here).
Please add support for complex queries with search result classes different from Specification query root

Affects: 1.0 M2
42 votes, 25 watchers

Duplicate issue #2959: DTO Projection not working with specification
Created: 2023-05-19T07:12:49Z
I was trying to use projection with specification, but I am getting the error:
Caused by: org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [com.entity.ParticipationEntity] to type [com.entity.TenantOnly]. The reason being select query has all the columns and not just the ones present in TenantOnly.
projection interface
public interface TenantOnly {
    String getTenantId();
}

@Data
@Entity
@Table(name = "participation", schema = "public")
public class ParticipationEntity {

    @Id
    @Column(name = "id")
    private Long id;

    @Column(name = "programId")
    private String programId;

    @Column(name = "tenantId")
    private String tenantId;

}

Spring Data repository
public interface ParticipationSpringDataRepository extends JpaRepository<ParticipationEntity, Long>, JpaSpecificationExecutor<ParticipationEntity> {
    List<TenantOnly> findAll(Specification specification);
}

public List<String> getParticipatingTenants(List<String> tenantIds,  List<String> programIds, OffsetDateTime processedDate){
    List<TenantOnly> tenantOnlies = participationSpringDataRepository.findAll(
            Specification.where(tenantIdIn(tenantIds))
                    .and(programId(programIds)));

    return tenantOnlies.stream().map(tenantOnly -> tenantOnly.getTenantId()).toList();
}

private Specification<ParticipationEntity> tenantIdIn(List<String> tenantIds){
    return (root,  query, criteriaBuilder) -> {
        if(tenantIds == null || tenantIds.isEmpty()){
            return criteriaBuilder.conjunction();
        }
        return criteriaBuilder.in(root.get(ParticipationEntity_.TENANT_ID)).value(tenantIds);
    };
}

build versions
org.springframework.boot:spring-boot-starter-data-jpa:3.0.5
org.postgresql:postgresql:42.6.0

Closing comment (2023-07-13T12:53:08Z): Closing this as duplicate of #487
Repository: spring-projects/spring-data-jpa

Issue #2954: Resolve handling of ESCAPE clause with LIKE queries on Hibernate
Created: 2023-05-15T17:54:17Z
ESCAPE clauses with special characters don't seem to work properly with custom queries on Hibernate. This appears to be involving SpEL substitutions and the HQL grammar.
Related: #2939, #2760

Duplicate issue #2975: BadJpqlGrammarException in 3.1.0 when using "escape" in a LIKE query via JPQL
Created: 2023-05-23T20:30:35Z
The following JPA repository method causes a BadJpqlGrammarException (mismatched input 'escape') when updating to Spring Data 3.1.0:
@Query("""
    select a from Animal a
    where a.name like :escapedQuery escape :escapeCharacter
    order by a.id""")
Page<Animal> findByNameLike(@Param("escapedQuery") String escapedQuery,
                            @Param("escapeCharacter") char escapeCharacter,
                            Pageable pageable);
Caused by: org.springframework.data.jpa.repository.query.BadJpqlGrammarException: Line 2:32 mismatched input 'escape' expecting {<EOF>, ',', AND, EXCEPT, GROUP, INTERSECT, OR, ORDER, UNION}; Bad JPQL grammar [select a from Animal a
where a.name like :escapedQuery escape :escapeCharacter
order by a.id]
	at org.springframework.data.jpa.repository.query.BadJpqlGrammarErrorListener.syntaxError(BadJpqlGrammarErrorListener.java:39)
	at org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:41)
	at org.antlr.v4.runtime.Parser.notifyErrorListeners(Parser.java:543)
	at org.antlr.v4.runtime.DefaultErrorStrategy.reportInputMismatch(DefaultErrorStrategy.java:327)
	at org.antlr.v4.runtime.DefaultErrorStrategy.reportError(DefaultErrorStrategy.java:139)
	at org.springframework.data.jpa.repository.query.HqlParser.start(HqlParser.java:257)
	at org.springframework.data.jpa.repository.query.HqlQueryParser.parseQuery(HqlQueryParser.java:53)
	at org.springframework.data.jpa.repository.query.HqlQueryParser.parse(HqlQueryParser.java:63)
	at org.springframework.data.jpa.repository.query.JpaQueryParserSupport$ParseState.lambda$new$0(JpaQueryParserSupport.java:182)
	at org.springframework.data.util.Lazy.getNullable(Lazy.java:245)
	at org.springframework.data.util.Lazy.get(Lazy.java:114)
	at org.springframework.data.jpa.repository.query.JpaQueryParserSupport$ParseState.getContext(JpaQueryParserSupport.java:194)
	at org.springframework.data.jpa.repository.query.JpaQueryParserSupport.findAlias(JpaQueryParserSupport.java:96)
	at org.springframework.data.jpa.repository.query.JpaQueryEnhancer.detectAlias(JpaQueryEnhancer.java:109)
	at org.springframework.data.jpa.repository.query.StringQuery.<init>(StringQuery.java:86)
	at org.springframework.data.jpa.repository.query.ExpressionBasedStringQuery.<init>(ExpressionBasedStringQuery.java:63)
	at org.springframework.data.jpa.repository.query.AbstractStringBasedJpaQuery.<init>(AbstractStringBasedJpaQuery.java:78)
	at org.springframework.data.jpa.repository.query.SimpleJpaQuery.<init>(SimpleJpaQuery.java:68)
	... 126 more

Closing comment (2023-05-24T14:41:13Z): This is a duplicate of #2954.
Repository: spring-projects/spring-data-jpa

Issue #2812: `NullPointerException` in version 3.0.2 when using modifying native queries or `SELECT` queries that Spring Data cannot parse 
Created: 2023-02-20T13:47:16Z
Commit 64b5a22 introduced a null pointer exception in line 620 of QueryUtils. If a native query is not a select, but, for example, a delete, "variable" will be null, leading to said exception.
Example code in repository:
	@Modifying
	@Query(value = "delete from some_table where id in :ids", nativeQuery = true)
	void deleteStuffFromSomeTable(@Param("ids") Collection<UUID> ids);

Relevant part of the trace:
Caused by: java.lang.NullPointerException: Cannot invoke "String.contains(java.lang.CharSequence)" because "variable" is null
	at org.springframework.data.jpa.repository.query.QueryUtils.createCountQueryFor(QueryUtils.java:620)
	at org.springframework.data.jpa.repository.query.DefaultQueryEnhancer.createCountQueryFor(DefaultQueryEnhancer.java:49)
	at org.springframework.data.jpa.repository.query.StringQuery.deriveCountQuery(StringQuery.java:111)
	at org.springframework.data.jpa.repository.query.AbstractStringBasedJpaQuery.<init>(AbstractStringBasedJpaQuery.java:82)
	at org.springframework.data.jpa.repository.query.NativeJpaQuery.<init>(NativeJpaQuery.java:58)
	at org.springframework.data.jpa.repository.query.JpaQueryFactory.fromMethodWithQueryString(JpaQueryFactory.java:53)
	at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$DeclaredQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:170)
	at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:252)
	at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:95)
	at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lookupQuery(QueryExecutorMethodInterceptor.java:111)
	... 79 more

Duplicate issue #2832: NPE in QueryUtils
Created: 2023-03-01T19:18:19Z
Spring boot v2.7.9
Spring data JPA 2.7.8
Class: org.springframework.data.jpa.repository.query.QueryUtils
Line: 607
It's possible that nativeQuery is true and variable is null.
In this case, an NPE occurs at variable.contains(",")
if (nativeQuery && (variable.contains(",") || "*".equals(variable))) {

Closing comment (2023-03-02T02:08:22Z): Duplicates #2812.
Repository: spring-projects/spring-data-jpa

Issue #1869: Fix it so count queries work properly for select new com.example.Dto(...) situations
Created: 2019-08-26T17:21:52Z
Phil Webb opened DATAJPA-1598 and commented
Originally raised in spring-projects/spring-boot#17961 but this looks like a Spring Data issue. I'll ask the OP for more info.
—
After upgrading spring boot to 2.1.7  from 2.1.6, running application are failing due to the issue:
Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: count near line 1, column 8 [select count(new map(model as levelTingkat)) from com.jasamedika.medifirst2000.entity.LevelTingkat model left join model.id id  where id.kdProfile=:kdProfile  and model.statusEnabled=true  ]

public interface  interface LevelTingkatDao extends CrudRepository.
Query : "select new map(model as levelTingkat) " 
            + " from LevelTingkat model left join model.id id "
            + " where id.kdProfile=:kdProfile "
            + " and model.statusEnabled=true  "

method: Page<Map<String, Object>> findAllList(
            @Param("kdProfile") Integer kdProfile,
            Pageable pageable);

In new CrudRepository,  it seem, has adding "count" to Query HQL, because present of Pageable parameter.

0 votes, 5 watchers

Duplicate issue #1895: Count query is created incorrectly when selecting new objects [DATAJPA-1587]
Created: 2019-08-08T13:18:15Z
Jeroen Hendrickx opened DATAJPA-1587 and commented
When I create a query that selects a new Object using a Pageable, the generated count query is incorrect.
E.g. the following query:
@Query("SELECT new com.acme.Foo(fooBar) " +
"FROM FooBar fooBar")
Generated the following count query:
select count(new com.acme.Foo(fooBar)) FROM FooBar fooBar
In release 2.1.9 the generated query was
select count(fooBar) FROM FooBar fooBar
which is the correct query.
It looks like this is a side effect from the changes requested in DATAJPA-1564.
Note, if I change the query and start it with a space, the count query is generated properly.
i've managed to write some tests on this in the org.springframework.data.jpa.repository.query.QueryTest:
This test passes:
@Test
public void createCountQueryForSelectNewStartingWithSpace() throws Exception {
        assertCountQuery(" SELECT new com.acme.Foo(fooBar) FROM FooBar fooBar", " select count(fooBar) FROM FooBar fooBar");
    }
While this test fails:
@Test
public void createCountQueryForSelectNewNotStartingWithSpace() throws Exception {
        assertCountQuery("SELECT new com.acme.Foo(fooBar) FROM FooBar fooBar", "select count(fooBar) FROM FooBar fooBar");
    }

Affects: 2.1.10 (Lovelace SR10)
Issue Links:

DATAJPA-1732 Spring jpql query validation failed for constructor method on spring boot 2.3
("is duplicated by")

1 votes, 1 watchers

Closing comment (2022-06-15T19:06:59Z): Duplicates #1869.
Resolved via f2e7bdd.
Repository: spring-projects/spring-framework

Issue #29210: Add ability to ignore request path prefixes in Observability server filters
Created: 2022-09-27T07:59:58Z
Both HttpRequestsObservationFilter and HttpRequestsObservationWebFilter record observations for Spring's web frameworks. It would be generally useful to provide an option to ignore some path prefixes entirely from instrumentation - for example, the Spring Boot Actuator endpoint should not be instrumented in an application.

Duplicate issue #29995: Tracing: Allow specific paths to be excluded
Created: 2023-02-19T18:02:57Z
Affects: 6.0.0+

When I enabled tracing in spring-web, I noticed, that even the actuator endpoints are included in the reported traces, which creates a lot of clutter and potentially cost in deployments, where the actuator endpoints are periodically pinged to check the health of instances.
There should be an option to exclude specific endpoints from tracing.
From what I could gather, maybe the best starting point would be the org.springframework.web.filter.ServerHttpObservationFilter. Either during creation of the FilterRegistrationBean, or in the class itself, a URL matcher logic could fit pretty neatly.
Another idea is to allow the probability of traces to be configured more granularly.

Closing comment (2023-02-19T19:42:19Z): Duplicates #29210
Repository: spring-projects/spring-framework

Issue #16519: Bean Validation invocation API for use with individual values and constraints [SPR-11900]
Created: 2014-06-23T10:58:09Z
Rossen Stoyanchev opened SPR-11900 and commented
The logic in MethodValidationInterceptor is pretty useful. However it is currently not easy to use if not in the context of AOP method interception. I'd like to be able to use it for invoking an @MVC HandlerMethod with the ability to validate method arguments first and then the method return value as a separate step.

Affects: 4.0.5
Issue Links:

#15017 Random results for JSR-303 method constraint validation on generically typed methods
#18007 @Validated support on Iterables (and implementors)
#19182 Validate values in top-level Map parameters

10 votes, 12 watchers

Duplicate issue #26841: @NotNull annotation is not enforced for @RequestParam when parameter is passed as an empty value
Created: 2021-04-21T14:34:14Z
Affects: \Spring Boot v2.3.9.RELEASE, Spring v5.2.13.RELEASE

When annotating a parameter of type Long of a controller with @NotNull for a @get method and passing the parameter as empty value, the parameter is received as null.
@RestController
@RequestMapping("testController1")
public class TestController {

    @GetMapping("testMethod1")
    public Long testMethod(@RequestParam @NotNull Long param1) {
        assertNotNull(param1);
        return param1;
    }

}

Getting 400 when requesting http://localhost:8082/testController1/testMethod1
Getting 200 when requesting http://localhost:8082/testController1/testMethod1?param1=555
Getting 500 when requesting http://localhost:8082/testController1/testMethod1?param1=&param2=bla
Expecting to 400 for the last case too.

Closing comment (2022-06-22T08:56:33Z): Closing as a duplicate of #16519 and #11041
Repository: spring-projects/spring-framework

Issue #19146: When favorPathExtension is false ResourceHttpRequestHandler serves resources with different content type in 4.3 compared to 4.2 [SPR-14577]
Created: 2016-08-10T10:51:12Z
Andy Wilkinson opened SPR-14577 and commented
As a result of this change, when favoring of path extensions is disabled ResourceHttpRequestHandler serves static resources with a content type based on the request's accept header. In the referenced Spring Boot issue this leads to HTML being served as application/json as the accept header was Accept: application/json,text/plain,\*/\*. With 4.2.x, the HTML page is served as text/html as expected.
I've attached a small Spring Boot application that reproduces the problem. It's configured to use Spring Framework 4.3.2 in order to reproduce the problem. Removing the override of the spring.version property from the pom will show the old, desired behaviour with Spring Framework 4.2.x.
With Spring Framework 4.3.2:
$ curl -I localhost:8080/ -H "Accept: application/json,text/plain,*/*"
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Last-Modified: Wed, 10 Aug 2016 09:49:22 GMT
Accept-Ranges: bytes
Content-Type: application/json;charset=UTF-8
Content-Language: en-US
Content-Length: 7
Date: Wed, 10 Aug 2016 09:49:32 GMT

With Spring Framework 4.2:
$ curl -I localhost:8080/ -H "Accept: application/json,text/plain,*/*"
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Last-Modified: Wed, 10 Aug 2016 10:44:33 GMT
Accept-Ranges: bytes
Content-Type: text/html;charset=UTF-8
Content-Language: en-US
Content-Length: 7
Date: Wed, 10 Aug 2016 10:44:45 GMT


Affects: 4.3.2
Reference URL: spring-projects/spring-boot#6562
Attachments:

gh-6562.zip (53.13 kB)

Issue Links:

#18233 ResourceHttpRequestHandler does not take into account mime types configured in WebMvcConfigurerAdapter
#19417 ResourceHttpRequestHandler no longer works as prototype bean

Duplicate issue #18769: Delivering static resources with wrong contenttype since 4.3RC1 (not in latest 4.2 release) [SPR-14196]
Created: 2016-04-21T07:05:00Z
Jens Goldhammer opened SPR-14196 and commented
I am running a spring boot application and just made an upgrade to Spring Boot from 1.3.3 to 1.4M2.
I have packaged my application as war file and also deliver static resources within my app to browsers, especially markdown files.
In Spring 4.2, markdown files were responded with correct content type.
In Spring 4.3RC1, markdown files are delivered back with json contenttype which leads to an error in the browser which tries to parse it as json and fails.
See conversation here:
https://gitter.im/spring-projects/spring-boot?at=571740ef98c544f1396cc5f7
Any idea where I can debug or what is missing here? Are there any changes in Spring MVC?

Affects: 4.3 RC1
Reference URL: https://gitter.im/spring-projects/spring-boot?at=571740ef98c544f1396cc5f7

Closing comment (2016-08-26T20:58:30Z): Rossen Stoyanchev commented
This looks like a potential duplicate #19146. Jens Goldhammer can you confirm if that's the case, in particular I would expect that that you also have favorPathExtension=false.
Repository: spring-projects/spring-framework

Issue #13913: Cache Abstraction Exception Handling [SPR-9275]
Created: 2012-03-28T11:54:05Z
Chris Bonham opened SPR-9275 and commented
Currently there is no explicit exception handling in the cache abstraction.  For example, when an external cache server is not available, the exceptions are just sent back to the calling class.  I propose changing the caching abstraction to catch the exception and then invoke the underlying method.

Affects: 3.1.1
Issue Links:

#13933 Add @Cacheable implementation support for exception handling allowing the service method to be called instead of letting the provider exception to break the service ("is duplicated by")
#16165 Support of ehcache's BlockingCache

Referenced from: commits 05e96ee
9 votes, 14 watchers

Duplicate issue #13933: Add @Cacheable implementation support for exception handling allowing the service method to be called instead of letting the provider exception to break the service [SPR-9295]
Created: 2012-04-02T01:57:09Z
Adriano Andrulis opened SPR-9295 and commented
Make @Cacheable implementation to support exception handling allowing the service method to be called instead of letting the provider exception to break the service.
If the cache is down we should still return the non cached response.
A new parameter i.e. ignoreCacheProviderExceptions parameter could be used to let the developers to decide if they want the behaviour or not.

Affects: 3.1.1
Issue Links:

#13913 Cache Abstraction Exception Handling ("duplicates")

2 votes, 4 watchers

Closing comment (2012-04-13T06:23:45Z): Chris Beams commented
Duplicates #13913.  Please add your votes to and watch that issue instead, thanks.
Repository: spring-projects/spring-restdocs

Issue #930: Facing issue with asciidoctor.jvm.convert 2.4.0 and spring docs 2.0.5 release Which is unable to load the child.html in the index html
Created: 2024-05-23T23:38:14Z
I am using gradle 8.6, and i refer to this example to configure asciidoctor - https://github.com/spring-projects/spring-restdocs-samples/blob/main/restful-notes-spring-hateoas/build.gradle
test {
useJUnitPlatform()
outputs.dir snippetsDir
}
asciidoctor {
configurations "asciidoctorExtensions"
inputs.dir snippetsDir
dependsOn test
doLast {
copy{
from ("${asciidoctor.outputDir}/html5")
into "$buildDir/resources/main/piblic/docs")
include "**/*.html"
}
I am getting below error when i try to load index HTML
Unresolved directive in index.adoc - include::child.adoc[]

Duplicate issue #931: Facing issue with asciidoctor.jvm.convert 2.4.0 and spring docs 2.0.5 release while creating war using gradle 8.6 the public/docs folder is not getting created 
Created: 2024-05-23T23:44:17Z
Hi I am using gradle 8.6 and sprin boot 2.7.6 .having issue while creating war through grade 8.6
test {
useJUnitPlatform()
outputs.dir snippetsDir
}
asciidoctor {
configurations "asciidoctorExtensions"
inputs.dir snippetsDir
dependsOn test
doLast {
copy{
from ("$buildDir/asciidoc/html5")
into "$buildDir/resources/main/public/docs")
include "**/*.html"
}
war {
enabled = true
dependsOn asciidoctor
}
war is getting created but the public docs folder is not there in the war

Closing comment (2024-05-24T06:18:40Z): Duplicates #930.
Repository: spring-projects/spring-restdocs

Issue #400: Cannot ignore undocumented fields passed to .andWithPrefix()
Created: 2017-06-08T10:06:48Z
Using relaxedResponseFields() has no effect on the fields passed to the following andWithPrefix(), as ignoreUndocumentedFields is set to false by default in the ResponseFieldsSnippet constructor used by andWithPrefix(), and there doesn't seem to be a way to tell restdocs to ignore the nested fields, too.
An additional method like andWithPrefix(String pathPrefix, boolean ignoreUndocumentedField, FieldDescriptor... additionalDescriptors) would be great to have!

Duplicate issue #420: relaxedResponseFields().and.andWithPrefix will ignore "ignoreUndocumentedFields"
Created: 2017-08-27T16:45:09Z
I found and and andWithPrefix method will return a new ResponseFieldsSnippet, but ignore the field ignoreUndocumentedFields:
public final ResponseFieldsSnippet andWithPrefix(String pathPrefix,
			FieldDescriptor... additionalDescriptors) {
		List<FieldDescriptor> combinedDescriptors = new ArrayList<>();
		combinedDescriptors.addAll(getFieldDescriptors());
		combinedDescriptors.addAll(PayloadDocumentation.applyPathPrefix(pathPrefix,
				Arrays.asList(additionalDescriptors)));
		return new ResponseFieldsSnippet(combinedDescriptors, this.getAttributes());
	}

Closing comment (2017-08-29T08:38:17Z): Duplicate of #400.
Repository: spring-projects/spring-restdocs

Issue #767: Support for GraphQL
Created: 2021-12-16T11:18:20Z
Hi,
Not sure is it a correct place to start the conversation.
Recently Spring team announced  support for GraphQL: https://spring.io/projects/spring-graphql
I'm wondering what it will take to provide a support for spring-restdocs project to support documentation for GraphQL.
Couple of questions:

is it a good place(repo) to start it.
From architecture stand point, what is required if we want to contribute support for graphql?

Thanks,
Artyom

Duplicate issue #779: provide support for GraphQl(Tester)
Created: 2022-01-13T19:12:34Z
Please add doc generation for tests excecuted via GraphQlTester Clients
https://docs.spring.io/spring-graphql/docs/1.0.0-SNAPSHOT/reference/html/#testing
Tx

Closing comment (2022-01-13T21:00:48Z): Duplicates #767. @cforce, please feel free to comment on that issue with your thoughts on the questions that I asked @ArtyomGabeev in this comment.
Repository: spring-projects/spring-restdocs

Issue #691: Add support for MockMvcWebTestClient
Created: 2020-08-25T07:27:09Z

Duplicate issue #897: WebTestClient: Add AutoConfiguration for MockMvcWebTestClient?
Created: 2023-10-17T08:19:50Z
I just stumbled accross this when moving a test from MockMvc to MockMvcWebTestClient.
As far as I could see the AutoConfigureRestDocs for WebTestClient only works in a reactive web app. It's not a big deal, as I could workaround like
@ExtendWith(RestDocumentationExtension.class)
@WebMvcTest(CustomerApiController.class)
class CustomerApiControllerTest {

    private WebTestClient client;

    @Autowired
    MockMvc mockMvc;

    @BeforeEach
    public void setUp(RestDocumentationContextProvider restDocumentation) {
        this.client = MockMvcWebTestClient.bindTo(mockMvc).baseUrl("http://localhost")
                .filter(documentationConfiguration(restDocumentation))
                .build();
    }
Can you imagine providing something like this with the AutoConfiguration?

Closing comment (2023-10-17T08:30:05Z): Duplicates #691 and spring-projects/spring-boot#35348.
Repository: spring-projects/spring-restdocs

Issue #398: Field beneath an array that is sometimes null cannot have a type other than varies
Created: 2017-06-06T09:43:40Z
In a response containing an array, certain fields could be sometimes null and sometimes not. Currently JsonFieldTypeResolver marks them as Varies. This forces me to document the fields as Varies. Which IMO doesnt add any value to the docs. This leads to following error.
org.springframework.restdocs.payload.FieldTypesDoNotMatchException: The documented type of the field '[].obj' is Array but the actual type is Varies
Would it wise to make an exception for null?
here is an example patch
diff --git a/spring-restdocs-core/src/main/java/org/springframework/restdocs/payload/JsonFieldTypeResolver.java b/spring-restdocs-core/src/main/java/org/springframework/restdocs/payload/JsonFieldTypeResolver.java
index 25c373c..e618a4b 100644
--- a/spring-restdocs-core/src/main/java/org/springframework/restdocs/payload/JsonFieldTypeResolver.java
+++ b/spring-restdocs-core/src/main/java/org/springframework/restdocs/payload/JsonFieldTypeResolver.java
@@ -35,10 +35,10 @@ class JsonFieldTypeResolver {
                        JsonFieldType commonType = null;
                        for (Object item : (Collection<?>) field) {
                                JsonFieldType fieldType = determineFieldType(item);
-                               if (commonType == null) {
+                               if (commonType == null && fieldType !== JsonFieldType.NULL) {
                                        commonType = fieldType;
                                }
-                               else if (fieldType != commonType) {
+                               else if (fieldType != commonType && fieldType !== JsonFieldType.NULL) {
                                        return JsonFieldType.VARIES;
                                }
                        }
I could use @JsonInclude(JsonInclude.Include.NON_NULL) to prevent null fields in REST response but I'd like to avoid that and use null and have consistent REST response with all fields.

Duplicate issue #428: Type determination for fields that have a mixture of null and non-null values is incorrect
Created: 2017-09-23T14:50:27Z
When a path identifies multiple values with a mixture of null and non-nulls (for example a.[].b and the payload {"a":[ {"b": null},{"b": 1}]} type determination is currently incorrect. It doesn't correctly consider the optionality of the field and also behaves differently if a field is null then not null versus not null then null.
If the field is described as optional then null values should be ignored and, in the example above, the field's type should be determined to be a number. If the field is not optional then the type should be varies. This applies irrespective of the ordering. If the values are a mixture of nulls and two or more non-null types, the field's type should be determined to vary irrespective of whether or not the field is optional.

Closing comment (2017-09-23T15:37:57Z): Duplicate of #398
Repository: spring-projects/spring-restdocs

Issue #262: Add support for REST Assured 3.0
Created: 2016-06-14T19:37:34Z
REST Assured 3.0 has been released. 3.0 uses new package names and Maven artifacts so it should be possible to support 3.0 alongside the existing support for 2.x.

Duplicate issue #349: Spring-restdocs
Created: 2017-02-16T13:40:19Z
Spring-restdocs-restassured uses an old version of restassured.
For instance RestAssuredRestDocumentationConfigurer implements Filter from package com.jayway.restassured.filter, instead of io.restassured.filter.
This causes users of restdocs with restassured to be stuck with versions prior to 3.x

Closing comment (2017-02-16T14:12:49Z): Duplicates #262
Repository: spring-projects/spring-restdocs

Issue #515: Request bodies appear to be empty when using MockMvc and Spring Framework 5.1
Created: 2018-06-14T14:16:44Z
The changes made for SPR-16505 mean that REST Docs can no longer use the request's input stream to read its body. The getContentAsByteArray() method, new in 5.0, should be used instead.

Duplicate issue #578: Content missing in http-request.adoc when...
Created: 2019-02-12T18:40:09Z
@wilkinsona
Just a heads-up that the JSON request-content is missing in http-request.adoc when
testCompile 'org.springframework.restdocs:spring-restdocs-mockmvc:2.0.1.RELEASE'

is used along with these dependencies:
compile 'org.springframework.boot:spring-boot-starter-**web**:2.1.2.RELEASE' &
testCompile 'org.springframework.boot:spring-boot-starter-**test**:2.1.2.RELEASE'

Thanks and best wishes,
~amit

Closing comment (2019-02-13T08:36:07Z): Duplicates #515.
Repository: spring-projects/spring-restdocs

Issue #70: Customization of Request and Response columns
Created: 2015-05-18T09:54:07Z
Right now we can have only three columned table for request and response fields, but what if we need to add an additional column for some requests or responses or rename an existing columns?
_Suggestion 1_
To add a factory for column fields like so
.andDo(document("assets/banks").response().withFields(
    fieldWithPath("id").description("UUID of the asset."),
    fieldWithPath("name").description("Name of the asset.")
)
And if we need to add _size_ column to response table:
.andDo(document("assets/banks").response(withColumn("size")).withFields(
    fieldWithPath("id").description("UUID of the asset.").column("size", "0..12"),
    fieldWithPath("name").description("Name of the asset.").column("size", "15..20")
)
Also if we need to rename default column _description_ into _info_:
.andDo(document("assets/banks").response(
    withDescriptionAs("info"),
    withColumn("size")
).withFields(
    fieldWithPath("id").description("UUID of the asset.").column("size", "0..12"),
    fieldWithPath("name").description("Name of the asset.").column("size", "15..20")
)
_Suggestion 2_
To create a _ColumnDescriptor_ class so we can extend columns more flexible.
.andDo(document("assets/banks").withResponseFields(
    fieldWithPath("id").with(description("UUID of the asset."), size(0, 23))
)
Then in case of renaming a default field you'll have to extend it and rename it.
P.S.
There is also an open question around the order of columns.

Duplicate issue #75: Add ways to improve the table's layout from code
Created: 2015-06-19T10:53:05Z
Let's say we have the following:
.andDo(
   RestDocumentation.document("users-list-example")
        .withQueryParameters(
            parameterWithName("filter").description("Type of the users to retrieve. Possible values are `staff` and `customers`")
        )
)

this will produce a table with two equal columns each one of them. In this particular cases it would be great to make the first column's width smaller then the second one..

Closing comment (2015-06-22T10:34:36Z): Thanks for the suggestion, @vicmosin. This issue is somewhat related to #70 and should probably be tackled at the same time.
In addition to making the column widths configurable, I think there's room to improve the defaults. I've opened #76 to track that.
Repository: sqldelight/sqldelight

Issue #2392: Incorrect parameter hints for AUTOINCREMENT keys
Created: 2021-05-11T13:48:10Z
Build Environment
SQLDelight version: 1.5.0
IDE version: Android Studio 4.1, 4.2, 2020.3.1 Arctic Fox Canary
Dialect: SQLite
Describe the bug
For tables with AUTOINCREMENT keys, the parameter hints displayed in the IDE are displayed incorrectly. Usually, you wouldn't want to create e.g. INSERT INTO statements that also provide an explicit value for these keys - they are auto-incremented after all. The IDE will always include these columns for the parameter hints, though.
Example
-- example.sq:

CREATE TABLE example (
    exampleId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
    name TEXT NOT NULL,
    description TEXT
);

insert:
INSERT INTO example (name, description)
VALUES (?, ?);

Expected
For the last line, the IDE highlights the parameters correctly:
VALUES (name: ?, description: ?);
Actual
The autoincrementing ID is part of the parameter hinting:
VALUES (exampleId: ?, name: ?);

Duplicate issue #2407: Insert Into ... VALUES(?) parameter hints incorrect when not all of columns are used
Created: 2021-05-17T11:01:49Z
Build Environment
SQLDelight version: 1.5.0
IDE version: Android Studio Arctic Fox | 2020.3.1 Canary 15
Dialect: MySQL
I have the following code:
CREATE TABLE Test (
    id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
    createdDate REAL NOT NULL,
    initialized BOOLEAN NOT NULL DEFAULT FALSE, 
    email TEXT
);

insert:
INSERT INTO Test(createdDate, email)
VALUES (UNIX_TIMESTAMP(), ?);

Bug IDEA suggestions ignores the fact that I have optional/default values.:

Closing comment (2021-05-17T11:15:05Z): dupe of #2392
Repository: sqldelight/sqldelight

Issue #4402: Compilation error on function in `GROUP BY` clause 
Created: 2023-07-21T15:20:50Z
SQLDelight Version
2.0.0-rc02
Operating System
macOS
Gradle Version
8.2
Kotlin Version
1.9.0
Dialect
SQLite 3.18
AGP Version
No response
Describe the Bug
Using a function in a GROUP BY causes a compilation error due to tables/columns not being found.
e.g.
CREATE TABLE ranks (
    first INTEGER NOT NULL,
    second INTEGER NOT NULL
);

bar:
SELECT * FROM ranks
GROUP BY max(ranks.first, ranks.second);
results in the following error
Compiling with dialect app.cash.sqldelight.dialects.sqlite_3_18.SqliteDialect

/Users/derekellis/projects/sqldelight-join-repro/src/main/sqldelight/com/example/Test.sq: (27, 13): No table found with name ranks
26    SELECT * FROM ranks
27    GROUP BY max(ranks.first, ranks.second)
                   ^^^^^

/Users/derekellis/projects/sqldelight-join-repro/src/main/sqldelight/com/example/Test.sq: (27, 26): No table found with name ranks
26    SELECT * FROM ranks
27    GROUP BY max(ranks.first, ranks.second)
                                ^^^^^

Removing the table name results in a similar error, but about the column names instead.
Compiling with dialect app.cash.sqldelight.dialects.sqlite_3_18.SqliteDialect

/Users/derekellis/projects/sqldelight-join-repro/src/main/sqldelight/com/example/Test.sq: (27, 13): No column found with name first
26    SELECT * FROM ranks
27    GROUP BY max(first, second)
                   ^^^^^

/Users/derekellis/projects/sqldelight-join-repro/src/main/sqldelight/com/example/Test.sq: (27, 20): No column found with name second
26    SELECT * FROM ranks
27    GROUP BY max(first, second)
                          ^^^^^^

This only seems to happen when the function is being used in a GROUP BY. Changing it to ORDER BY for example is fine.
Stacktrace
No response
Gradle Build Script
No response

Duplicate issue #4412: GROUP BY COALESCE is broken with rc02
Created: 2023-07-24T14:33:03Z
SQLDelight Version
2.0.0-rc02
SQLDelight Dialect
sqlite:3.18
Describe the Bug
After updating from 2.0.0-alpha05 to 2.0.0-rc02, the following valid query fails:
CREATE TABLE foo (
  id TEXT NOT NULL PRIMARY KEY,
  property1 TEXT,
  property2 TEXT
);

query:
SELECT *
  FROM foo
  GROUP BY COALESCE(foo.property1, foo.property2)
;
Stacktrace
No table found with name foo

Closing comment (2023-07-24T14:41:31Z): Duplicate of #4402 (which was itself a duplicate).
@hfhbd I think it'd be worth leaving this issue open until the new sql-psi release is cut and merged into here.
Repository: sqldelight/sqldelight

Issue #5086: Add support for pg RIGHT/FULL [OUTER] JOIN
Created: 2024-03-22T12:46:33Z
Description
Support for RIGHT and FULL joins would be great to have maximum flexibility without relying on hacks using LEFT JOIN or UNION.

Duplicate issue #5122: [PostgreSQL Dialect]: Support `LATERAL` Subqueries
Created: 2024-04-05T10:08:26Z
Description
As of now, SQLDelight doesn't support PostgreSQL's LATERAL subqueries yet.

Closing comment (2024-04-05T15:15:18Z): Related to #5086 and sqldelight/sql-psi#616
Looking into how this can be added in PostgreSql Dialect
Repository: sqldelight/sqldelight

Issue #3104: Annotate generated classes
Created: 2022-04-18T07:28:50Z
Description
Now that we can do id AS VALUE and version AS LOCK and there's also the json extension would it be possible to support Parcelable using an extension?
As for the syntax I'd imagine something like this:
import android.os.Parcelable;
import kotlinx.android.parcel.Parcelize;

CREATE TABLE @Parcelize foo AS Parcelable (
  id TEXT NOT NULL PRIMARY KEY,
  state INTEGER NOT NULL,
);
This only works when adding the parcelable extension similar to how the json extension works. Ideally, the same syntax can be used for CREATE VIEW.

It should also allow typealiasing to those types as when using Kotlin Multiplatform you usually do something like:
commonMain:
expect interface Parcelable

@OptIn(ExperimentalMultiplatform::class)
@OptionalExpectation
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.BINARY)
expect annotation class Parcelize()
androidMain:
actual typealias Parcelable = android.os.Parcelable
actual typealias Parcelize = kotlinx.android.parcel.Parcelize
iosMain:
actual interface Parcelable

Duplicate issue #3756: Provide an option to generate normal table class
Created: 2022-12-30T08:09:30Z
Description
Compiler always generate table classes with data class, but data class may generate some useless methods automatically.
These methods may bring volume increasing to native targets (like iOS).
Maybe gradle plugin can provide an option to generate table classes without data modifier.

Closing comment (2022-12-30T14:31:38Z): Okay, changing the default, data class to class is also possible and wouldn't be related to #3104, only if we want to support different generated code.
Repository: sqldelight/sqldelight

Issue #2367: java.lang.AssertionError in SqlDelightFindUsagesProvider.kt:28
Created: 2021-04-30T16:14:44Z
Error in SQL Delight IntelliJ Plugin
java.lang.AssertionError in SqlDelightFindUsagesProvider.kt:28
View on Bugsnag
Stacktrace
SqlDelightFindUsagesProvider.kt:28 - com.squareup.sqldelight.intellij.SqlDelightFindUsagesProvider.getType

View full stacktrace
Created automatically via Bugsnag

Duplicate issue #2544: java.lang.AssertionError in SqlDelightFindUsagesProvider.kt:28
Created: 2021-08-25T13:53:30Z
Error in SQL Delight IntelliJ Plugin
java.lang.AssertionError in SqlDelightFindUsagesProvider.kt:28
View on Bugsnag
Stacktrace
SqlDelightFindUsagesProvider.kt:28 - com.squareup.sqldelight.intellij.SqlDelightFindUsagesProvider.getType

View full stacktrace
Created automatically via Bugsnag

Closing comment (2021-09-28T20:20:17Z): dupe #2367
Repository: sqldelight/sqldelight

Issue #139: IllegalStateException in TableGenerator.kt:129 uncaught in plugin
Created: 2016-02-19T18:11:04Z
Adding a .sq file outside of expected /src/main/sqldelight directory throws exception that plugin doesn't catch. Intellij/Android Studio 'helpfully' suggests disabling plugin.
Minimum fix would cause an error balloon to display. Desired fix would be to present user with action to move new file to desired file structure.

Duplicate issue #162: Cannot use the Generated Model classes with the rawQuery(...) calls
Created: 2016-02-29T09:21:56Z
Cannot performing rawQueries from the generated classes. Cannot locate the xxModel class to create the xx class.
For example, in the example code in the README file, I cannot create HockeyPlayer as the generated HockeyPlayerModel class cannot be found.
public List<HockeyPlayer> alecs(SqliteDatabase db) {
  List<HockeyPlayer> result = new ArrayList<>();
  try (Cursor cursor = db.rawQuery(HockeyPlayer.SELECT_BY_NAME, new String[] { "Alec" })) {
    while (cursor.moveToNext()) {
      result.add(HockeyPlayer.MAPPER.map(cursor));
    }
  }
  return result;
}

I have tried to create the class using @AutoValue as suggested in the README, but the IDE cannot find the xxModel class. How and where do these get created?
Edit: I noticed all my xxModel classes don't have any package declaration in them, where as the Android generated R classes do.

Closing comment (2016-02-29T12:11:26Z): Sounds good, we'll show these errors in the IDE with a red squiggly similar to #139.
Repository: sqldelight/sqldelight

Issue #539: USING clause incorrectly assumes there is a duplicate column for the columns specified in USING
Created: 2016-10-31T14:29:28Z

Duplicate issue #573: Column indices are wrong if joins are performed with USING
Created: 2016-12-21T13:37:24Z
If you perform a join like this:
SELECT * FROM table1 LEFT JOIN table2 USING (someField)

The generated result set will only have one column of someField. SqlDelight however expects that the column from the second table is still present and will index to it. This causes the indices to be off by one and eventually attempts to access an index equal to the column count.
E.g. I had a joined query like this where after the join (with USING) had 31 columns, but SqlDelight expected there to be 32 in the generated mapper (which it is if I do ON a.someField = b.someField).
Quote from the Sqlite docs:

For each pair of columns identified by a USING clause, the column from the right-hand dataset is omitted from the joined dataset. This is the only difference between a USING clause and its equivalent ON constraint.

Closing comment (2016-12-21T13:59:33Z): Duplicate of #539