Skip to content

Tag: spring-boot

Fail to generate allure-results directory based on JUnit 4

I failed to generate the directory allure-results in my project. I have tried many methods from google(create src/test/resources/, set <resultsDirectory>${}/allure-results</resultsDirectory> in pom.xml, etc.), but all setting seems not to take effect. I also failed to redirect the result to other directories. It always said “[ERROR] Directory <project_path>/target/allure-results not found”. My command to generate report is My pom.xml is like: Answer

Spring jpa database connection for native query

I have a spring application that have to connect to a sql server db. There are no @Entity class and there ate no @Repository because the tables and the columns of the tables are unknown to the application. I have created a class and used an entity manager to execute queries, but I’m not sure this is the best choice

How to access configuration beans in Spring controllers

I have a Spring Boot application that uses Spring profiles to create environment specific configurations, for example: I have a @RestContoller that needs to access the values that the configurations load from How can I inject the current environment specific configuration bean inside the controller? Example: Answer If you need to access values from the or .yaml configuration

type=search_phase_execution_exception, reason=all shards failed when i send ‘/’

I’m using elasticSearch with RestHighLevelClient and Java. When I put query: QueryBuilder qb = new QueryStringQueryBuilder(“” + valueSearch.toLowerCase() + “”). Where valueSearch contain “/” -> example REC2/. The searchResponse =, RequestOptions.DEFAULT) return me Caused by: org.elasticsearch.ElasticsearchStatusException: Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed]. However, when I send Rec2/2/3 or Rec// everything its ok. Version elastic: 7.3.0 Answer The query_string query