Spring

Java Webapp runs fine in Eclipse but not in Tomcat

别说谁变了你拦得住时间么 提交于 2021-02-08 07:37:25
问题 I have a small Java/Spring MVC REST /Maven app that runs just fine in Eclipse but also when I run the following command from the prompt: mvn clean tomcat6:run My problem is when I do: mvn clean package and push the generated war file to the "webapps" folder in my standalone Tomcat instance, the service doesn't work anymore. The standalone Tomcat starts up just fine, no error in the logs. Interestingly enough though the standalone instance listens on port 8989 vs. 8080 when I run the app in

Not exposing the path of entities that have a composite primary key to the front end when using the Springframework Page object

你离开我真会死。 提交于 2021-02-08 07:29:33
问题 I'm working on an API endpoint that returns a Springframework Page response. I want the front end to be able to sort the data but I can't expect the front end to know that the column they want to sort on is actually inside a composite primary key. In the example below (a simplified version of what I'm working on) you can see that the startDate column is inside a RouteEntityPk class, which is linked to the RouteEntity class with the @EmbeddedId annotation. To Sort on that column the front end

Spring REST API multiple RequestParams vs controller implementation

血红的双手。 提交于 2021-02-08 07:22:42
问题 I'm wondering about proper way of implementating of controller in case of GET request with multiple request params given. In my understanding of REST it's much better to have one endpoint with additional parameters for filtering/sorting than several endpoints (one for each case). I'm just wondering about maintanance and extensibility of such endpoint. Please have a look on example below : @RestController @RequestMapping("/customers") public class CustomerController { @Autowired private

Spring REST API multiple RequestParams vs controller implementation

拥有回忆 提交于 2021-02-08 07:20:24
问题 I'm wondering about proper way of implementating of controller in case of GET request with multiple request params given. In my understanding of REST it's much better to have one endpoint with additional parameters for filtering/sorting than several endpoints (one for each case). I'm just wondering about maintanance and extensibility of such endpoint. Please have a look on example below : @RestController @RequestMapping("/customers") public class CustomerController { @Autowired private

Spring WebFlux with traditional Web Security

≡放荡痞女 提交于 2021-02-08 06:54:21
问题 I tried to test Spring WebFlux with traditional Web Security( @EnableWebSecurity ). I used the Tomcat intead of Netty. I got the follow error message. *************************** APPLICATION FAILED TO START Description: The bean 'springSecurityFilterChain', defined in class path resource [org/springframework/boot/actuate/autoconfigure/security/reactive/ReactiveManagementWebSecurityAutoConfiguration.class], could not be registered. A bean with that name has already been defined in class path

Context Param Values in web.xml get ignored

非 Y 不嫁゛ 提交于 2021-02-08 06:51:18
问题 I was always wondering why no primefaces theme gets applied and could never fix it. Today I found out that when I add a Bean "ServletContextInitializer" to my Application with the same stuff like in the web.xml it works. I read something that app.properties maybe overrides the settings? I got a application.properties but just for the database and jpa/hibernate. Application: @EnableAutoConfiguration @ComponentScan({ "de.develop.telefonbuch" }) public class Application extends

Image does not show using thymeleaf and spring

余生长醉 提交于 2021-02-08 06:50:38
问题 The image is in the following directory: /src/main/resources/static/images/logo.png And this is my HTML tag: <img width="220px" height="70px" th:src="@{/static/images/logo.png}"/> However, when i'm trying to access the image, this error shows up: There was an unexpected error (type=Not Found, status=404). No message available 回答1: You don't need static in the path. You should use @{/images/logo.png} , because default resolver maps /src/main/resources/static/ to / url in your case. From

Context Param Values in web.xml get ignored

痞子三分冷 提交于 2021-02-08 06:50:37
问题 I was always wondering why no primefaces theme gets applied and could never fix it. Today I found out that when I add a Bean "ServletContextInitializer" to my Application with the same stuff like in the web.xml it works. I read something that app.properties maybe overrides the settings? I got a application.properties but just for the database and jpa/hibernate. Application: @EnableAutoConfiguration @ComponentScan({ "de.develop.telefonbuch" }) public class Application extends

Image does not show using thymeleaf and spring

二次信任 提交于 2021-02-08 06:50:18
问题 The image is in the following directory: /src/main/resources/static/images/logo.png And this is my HTML tag: <img width="220px" height="70px" th:src="@{/static/images/logo.png}"/> However, when i'm trying to access the image, this error shows up: There was an unexpected error (type=Not Found, status=404). No message available 回答1: You don't need static in the path. You should use @{/images/logo.png} , because default resolver maps /src/main/resources/static/ to / url in your case. From

Spring boot - POST method not allowed

不想你离开。 提交于 2021-02-08 06:48:48
问题 I'm dwelling with this problem... I have a Spring Boot application wit a S2S communication. I have a @RestController method which should accept POST request. This is the controller @RestController public class PaymentRestController { @PostMapping("/util/paymentResponse") public void savePaymentResponse(@RequestParam boolean transaction_status, @RequestParam String usedToken, @RequestParam String transaction_message, @RequestParam String authCode, @RequestParam String transactionCode,