spring-boot

Creating tables and importing data from .sql files in Spring boot

故事扮演 提交于 2021-02-10 06:42:08
问题 Current apporach: application.properties spring.datasource.url=jdbc:mysql://localhost:3306/db_name spring.datasource.username=root spring.datasource.password=admin spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.testWhileIdle = true spring.datasource.validationQuery = SELECT 1 spring.jpa.show-sql = true spring.jpa.hibernate.ddl-auto=update spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy spring.jpa.properties.hibernate.dialect=org

ActiveMq transaction on @JmsListener

只愿长相守 提交于 2021-02-10 06:38:47
问题 I try to make a Jms consumer with activeMq broker witch have an "transactional" acknowledge. I want to use spring boot application. I read that I need JTA transaction but I don't know how I can start one. My main class: @SpringBootApplication @EnableJms public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } } My consumer : @Component public class ReceiveMessage { @JmsListener(destination = "${jms.queue.destination}") public void

SpringBoot external jar not load

柔情痞子 提交于 2021-02-10 06:33:34
问题 i have a java project with spring boot and I need to load application.properties and dependency jar from external folder. I tested by using the application.properties in the classpath, and the loader.path property work correctly. When I use external properties file (I'm sure they're used) the loader.path not work correctly and the result is ClassNotFound because the jars are not loaded. Also when i launch the application with **-Dloader.path=**xxx it's work correctly. How can I solve the

Configuring nginx config files in AWS elasticbeanstalk with .ebextensions not found

白昼怎懂夜的黑 提交于 2021-02-10 06:23:06
问题 I am trying to enable https to my springboot webserver backend deployed on AWS elastic beanstalk with a self-signed SSL. I followed online tutorials and guides to change my nginx config with a new https-instance.config. files: /etc/nginx/conf.d/myconf.conf: mode: "conf" owner: root group: root content: | # HTTPS server server { listen 443; server_name localhost; ssl on; ssl_certificate /etc/pki/tls/certs/server.crt; ssl_certificate_key /etc/pki/tls/certs/server.key; ssl_prefer_server_ciphers

Unable to Field identify bean named 'entityManagerFactory' as using Auto-wiring annotation to Repository

折月煮酒 提交于 2021-02-10 06:18:28
问题 Error APPLICATION FAILED TO START Description: Field ProRepo in com.pvs.products.testservice.ProService required a bean named 'entityManagerFactory' that could not be found. The injection point has the following annotations: @org.springframework.beans.factory.annotation.Autowired(required=true) Action: Consider defining a bean named 'entityManagerFactory' in your configuration. Code build.gradle plugins { id 'org.springframework.boot' version '2.1.12.RELEASE' id 'io.spring.dependency

Why can't my class find “ContractVerifierUtil”?

元气小坏坏 提交于 2021-02-10 06:18:12
问题 I am trying to implement stubs in my project but I am getting the follwing error when I try to build it: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project customer-previous-address-older-version: Compilation failure [ERROR] /archive/target/generated-test-sources/contracts/address/ContractVerifierTest.java:[18,63] cannot find symbol [ERROR] symbol: class ContractVerifierUtil [ERROR] location: package org

@SpringBootApplication - ComponentScan does not work as intended in new Eclipse project

…衆ロ難τιáo~ 提交于 2021-02-10 06:01:49
问题 I recently started using Eclipse (moved from IntelliJ Idea) but whatever new SpringBoot app I start writing, I always get this problem. The @SpringBootApplication on my main class does not work as intended. I should be able to get away without adding the @ComponentScann annotation (I know it would make it work), but the intention of this post is to find out the route cause of the original failure. I already know work-arounds. My app always breaks with the following error message: . ____ _ __

How to generate WebSphere MQ Message from Spring JMS?

不打扰是莪最后的温柔 提交于 2021-02-10 05:18:10
问题 I need to produce queue message in WebSphere MQ message format. By default spring produced the message in JMS format. I have googled and came to know that WebSphere MQ Message format contains MQMD and RFH2 header. No idea how to generate these two from Spring. 回答1: Where Tomcat context.xml is the JNDI provider for MQ, I did it like this: <Resource name="jms/myreqqueue" auth="Container" type="com.ibm.mq.jms.MQQueue" factory="com.ibm.mq.jms.MQQueueFactory" QU="MY.REQ.QUEUE" TC="1" /> Notice the

How to generate WebSphere MQ Message from Spring JMS?

空扰寡人 提交于 2021-02-10 05:13:57
问题 I need to produce queue message in WebSphere MQ message format. By default spring produced the message in JMS format. I have googled and came to know that WebSphere MQ Message format contains MQMD and RFH2 header. No idea how to generate these two from Spring. 回答1: Where Tomcat context.xml is the JNDI provider for MQ, I did it like this: <Resource name="jms/myreqqueue" auth="Container" type="com.ibm.mq.jms.MQQueue" factory="com.ibm.mq.jms.MQQueueFactory" QU="MY.REQ.QUEUE" TC="1" /> Notice the

Mapstruct to update values without overwriting

南楼画角 提交于 2021-02-10 05:11:42
问题 Is there a way to instruct MapStruct to not overwrite values in the target? For example: public interface IMyMapper { IMyMapper INSTANCE = Mappers.getMapper(IMyMapper.class); @Mappings({ @Mapping(target = "foo", source = "source.FOO"), @Mapping(target = "bar", source = "source.BAR2"), }) void updateTargetEntity(@MappingTarget MyTarget target , MySource source); } class MyTarget { String a; String b; ... } class MySource { String a; String b; ... } Where for instance target will have a = "asdf