Spring

@Transactional not working when i throw exception on next line

故事扮演 提交于 2021-02-11 15:13:09
问题 I don't understand the below behavior: I have a method: @Transactional public void processRejection(final Path path) { try { //some code here } catch (final Exception e) { this.handleException(e)); } } which calls the below which does a saves an entity which doesn't yet exists in the database: void handleException(final Throwable e) { this.filesMonitoringJpaManager.save(someEntityHere); throw new Exception(...) } Now the strange is when I comment the throw new Exception(...) the save works,

Spring boot Webservice / Microservices and scheduling

耗尽温柔 提交于 2021-02-11 15:11:41
问题 I am having a spring boot application which exposes REST APIs and also am planning to add a spring boot scheduled task. The purpose of task is to pick up some pending 'reservations' from data store which is momgodb and process it. Now the question is when multiple instances of service running, there is high probability all the nodes will pick up same 'reservation records'. I was looking at mongodb lock for this and was checking updateAndModidy / transactions (in 4.x) of mongodb. Also

Why do I need to set target folder as source folder? How was the project compiled for the first time when “target” wasn't cretaed?

本秂侑毒 提交于 2021-02-11 15:10:32
问题 I have an existing maven project (IDE used: Sprint Test Tool) and I have very very limited help available around it. I'm new to maven, java and stuff (I know basic java and have done automation in java but haven't worked on full-fledged java projects) and I have to figure our all of this project more or less by myself. I was trying to compile the package but it shows errors in main\src\java that "Messages can NOT be resolved" over some code of this sort: Messages.. I searched through the

Gradle Multi Module Project: Apply module dependency to all subprojects except for itself

ぃ、小莉子 提交于 2021-02-11 15:10:24
问题 My application is a Gradle Multi Module Project, consisting of multiple services with one service-common module. I´ve pulled all dependencies that all modules have in common out into the root build.gradle, and I also want to include the service-common module in all subprojects, which in theory works, but I´m getting a circular dependency issue because it is included in itself. apply plugin: 'java' group = 'com.myapplication' ext { set('springCloudVersion', "2.2.0.RELEASE") set(

Websphere MQ message redelivery

北城余情 提交于 2021-02-11 15:09:20
问题 I have a Websphere MQ and a java app receiveng messages from it. I want to make redelivering system if any exceptions is thrown in my app. I'm using spring transaction manager, but the problem is if the message cause an exception in my app, the app is trying to resend the same message. Can i put a broken message in the end of the queue if there were some (2,3 etc) unsuccessful attempts of redelivery? here's my spring configuration: <bean id="mqMessageListener" class="ru.mos.notification

How to load only profile specific property file and ignore default application.properties?

可紊 提交于 2021-02-11 15:00:55
问题 I have a normal spring boot application, and two property files in resources folder: application.properties com.example.prop1=value1 com.example.enableMock=true application-dev.properties com.example.prop1=value11 I have some logic based on whether com.example.enableMock is present or missing. Problem is spring loads both files even if spring.profiles.active=dev and the application is getting the com.example.enableMock property. How do I just load profile specific property file? 回答1: By

Spring alternative to JAXRSClientFactory

我怕爱的太早我们不能终老 提交于 2021-02-11 14:58:31
问题 I have an interface with javax-ws-rs annotations for endpoints, and I am creating JAXRSClientFactory from cxf. Interface looks like this @Path("/ws") public interface TheWebServiceResource { @Path( "/" ) @Produces( { MediaType.APPLICATION_JSON } ) @GET Response handshake() ; } Then I create the resource TheWebServiceResource myResource = JAXRSClientFactory.create(url, cls, providers, features, conf); Now I know I could change the annotations to spring ones - @RequestMapping above the

Having configuration files outside jar file in Spring Boot

跟風遠走 提交于 2021-02-11 14:52:22
问题 I have a Spring boot camel application whose directory structure is like this I want to convert this project into a jar file. But I want 3 files outside my jar so that I don't need to redeploy my application again and again when the configuration is changed. those 3 files are application.properties CamelContext.xml sql.properties I have the flexibility to hardcode the path of the file location. Can anyone help me out how do I achieve this? 回答1: Since I have resolved the issue I will post the

Java开发企业级权限管理系统

时间秒杀一切 提交于 2021-02-11 14:50:32
Java开发企业级权限管理系统 download: 百度云盘 全程手把手带你运用Java技术栈,打造一套基于最流行的RBAC拓展模型的,分布式的,有界面的,高灵活性,高拓展性的企业级权限管理系统。学完本课程你将可以轻松应对绝大多数企业开发中与权限管理及后台系统相关的需求。 技术储备要求 后端技术要求:有SSM、Maven、Redis基础 前端技术要求:有jQuery、Bootstrap、Mustache、zTree、Duallistbox基础 课程目錄 : 第1章 课程整體概述(購置套餐更劃算) 本章首先引見爲什麼大公司都有權限管理係統,然後會對權限管理中盛行的RBAC模型及拓展做重點阐明,並給出理想中的權限管理係統應該是什麼樣子的。之後會對這門课程做總體内容引見與课程佈置,最後會引見這門课程會觸及到的技術,讓大家明白理解到這門课程到底能收獲些什麼(课程提供QQ交流群)。... 1-1 课前必讀(不看會錯過一個億) 1-2 课程導學試看 1-3 爲什麼企業級項目需求權限管理試看 1-4 權限管理的中心是什麼? 1-5 理想中的權限管理應該是什麼樣的?試看 1-6 主流開源權限管理框架有哪些? 1-7 课程佈置與學問點引見 第2章 Spring Security權限框架理論與實戰演練 本章首先讓大家學習到Spring Security權限框架的架構,之後大家能夠學習到Spring

FCM and self-certificate issue (reopen)

主宰稳场 提交于 2021-02-11 14:49:13
问题 I'm using FCM to send a notification, my code works well when I use HTTP. The issue happened when I enable SSL using self-certificate, I cannot call subscribe/unsubscribe to/from a topic on FCM with error UNKOWN code. Any idea this issues please help I'm trying to debug so I can get access-token but cannot call sub/unsubscribe This is the request to get access-token 2020-12-02T16:06:24.192Z|2|INFO|fcm-demo|c5230eb4f07f582a,9b72559f0d3b8e39,true,|9|task-2|com.google.api.client.http