spring-config

Spring - Error Parameter 0 of constructor in Service required a bean of type Configuration that could not be found

强颜欢笑 提交于 2020-05-30 02:17:50
问题 I followed tutorial for uploading files but I end up with the following error: Parameter 0 of constructor in nu.pk.cv.storage.FileSystemStorageService required a bean of type 'nu.pk.cv.storage.StorageProperties' that could not be found. Action: Consider defining a bean of type 'nu.pk.cv.storage.StorageProperties' in your configuration The only difference that I know that I have done is that I use @RestController instead of only @Controller And that I have my controller in another subpackage

Spring - Error Parameter 0 of constructor in Service required a bean of type Configuration that could not be found

大兔子大兔子 提交于 2020-05-30 02:17:20
问题 I followed tutorial for uploading files but I end up with the following error: Parameter 0 of constructor in nu.pk.cv.storage.FileSystemStorageService required a bean of type 'nu.pk.cv.storage.StorageProperties' that could not be found. Action: Consider defining a bean of type 'nu.pk.cv.storage.StorageProperties' in your configuration The only difference that I know that I have done is that I use @RestController instead of only @Controller And that I have my controller in another subpackage

Spring - Error Parameter 0 of constructor in Service required a bean of type Configuration that could not be found

隐身守侯 提交于 2020-05-30 02:17:12
问题 I followed tutorial for uploading files but I end up with the following error: Parameter 0 of constructor in nu.pk.cv.storage.FileSystemStorageService required a bean of type 'nu.pk.cv.storage.StorageProperties' that could not be found. Action: Consider defining a bean of type 'nu.pk.cv.storage.StorageProperties' in your configuration The only difference that I know that I have done is that I use @RestController instead of only @Controller And that I have my controller in another subpackage

Spring Boot: Multiple similar ConfigurationProperties with different Prefixes

时间秒杀一切 提交于 2020-05-22 19:05:27
问题 I'm using Spring Boot and have two very similar services which I'd like to configure in my application.yml . The configuration looks roughly like this: serviceA.url=abc.com serviceA.port=80 serviceB.url=def.com serviceB.port=8080 Is it possible to create one class annotated with @ConfigurationProperties and set the prefix at the injection point? e.g. @Component @ConfigurationProperties public class ServiceProperties { private String url; private String port; // Getters & Setters } and then in

Caused by: java.lang.IllegalStateException: EntityManagerFactory must not be null

时光怂恿深爱的人放手 提交于 2019-12-24 18:13:30
问题 I previously was using Spring Boot 1.4.2.RELEASE and Hibernate 5.0.11.Final , and this was my Database configuration class: @Configuration @EnableTransactionManagement public class DataBaseConfiguration { @Bean(name = "sessionFactory") public HibernateJpaSessionFactoryBean sessionFactory() { return new HibernateJpaSessionFactoryBean(); } @Bean public HibernateTransactionManager transactionManager() { HibernateTransactionManager transactionManager = new HibernateTransactionManager();

org.springframework.cloud.task.launcher.TaskLauncherSink required a bean of type 'org.springframework.cloud.deployer.spi.task.TaskLauncher'

假装没事ソ 提交于 2019-12-11 16:04:31
问题 I am trying to run spring cloud task rabbitmq, but I am receiving errors as follows: . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.0.4.RELEASE) 2018-08-14 16:54:53.674 INFO 6676 --- [ main] lsightSpringcloudM3TaskintakeApplication : Starting PluralsightSpringcloudM3TaskintakeApplication on P2BLAP-FG4DVP2

How to use injection with XmlMapper deserialization

狂风中的少年 提交于 2019-12-11 04:24:23
问题 I am using XmlMapper from com.fasterxml.jackson.dataformat.xml . The class, I am serializing, has an Autowired member that is not serialized. I want to be able to deserialize the XML into an instance and have the autowired member variable populated by Spring . Is there a way to do this? 回答1: ObjectMapper has setInjectableValues method which allow to register some external beans which we want to use during serialisation / deserialisation . For example, DeserializationContext class has

Spring Boot: Profiles ignored in PropertySourcesPlaceholderConfigurer loaded file

泪湿孤枕 提交于 2019-12-11 03:52:15
问题 I have a library that is a Spring Boot project. The library has a library.yml file that contains dev and prod props for its configuration: library.yml --- spring: profiles: active: dev --- spring: profiles: dev env: dev --- spring: profiles: prod env: prod Another application uses this library and loads the props using: @Bean public static PropertySourcesPlaceholderConfigurer dataProperties() { PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new

@RefreshScope and /refresh not working

孤街浪徒 提交于 2019-12-03 16:39:25
I have tried to implement spring external configurations using Config Server. It is working fine for the very first time when the application is started but any changes to the properties file are not being reflected. I tried to use /refresh endpoint to refresh my properties on the fly but it doesn't seem to be working. Any help on this would be greatly helpful. I tried POSTing to localhost:8080/refresh but getting a 404 Error response. Below is the code of my application class @SpringBootApplication public class Config1Application { public static void main(String[] args) { SpringApplication

@RefreshScope and /refresh not working

微笑、不失礼 提交于 2019-11-30 15:55:20
问题 I have tried to implement spring external configurations using Config Server. It is working fine for the very first time when the application is started but any changes to the properties file are not being reflected. I tried to use /refresh endpoint to refresh my properties on the fly but it doesn't seem to be working. Any help on this would be greatly helpful. I tried POSTing to localhost:8080/refresh but getting a 404 Error response. Below is the code of my application class