Skip to content
Advertisement

Tag: spring-boot

Spring Boot ConflictingBeanDefinitionException: Annotation-specified bean name for @Controller class

I keep getting the ConflictingBeanDefinitionException error in my Spring boot application. I am not entirely sure as to how to address it, I have several @Configuration annotated classes helping to set up Thymeleaf, Spring Security and Web. Why is the application trying to setup the homeController twice? (and where is it trying to do this?) The error is: My spring

Spring Boot Program cannot find main class

I have a program which runs as a Spring boot App in eclipse. The program was running fine. Then i did the following: Right click on project -> Run As -> Maven Test . This was accidental. When i then tried to run the program as a spring boot app again, it threw the following error below. Error: Could not

Spring Boot – Error creating bean with name ‘dataSource’ defined in class path resource

I have Spring Boot web application. It’s centered around RESTful approach. All configuration seems in place but for some reason MainController fails to handle request. It results in 404 error. How to fix it? Application ParserController UPDATE Seems like MySQL cannot be initialized by Spring…. UPDATE2 application.properties UPDATE4 Seems lite controllers not responding eventhough @RequestMapping are set. Why might it

Spring boot not executing schema.sql script

I’m developing a Spring Boot web application and want to create a MySql database if it’s not already created. So I’ve done a dump of my current database in order to have an empty schema of it. Put it in /src/main/resources, so maven brings it to /WEB-INF/classes when building the war file. That’s how my application.properties is configured (according to

json date format in spring-boot

I am using spring-boot and I have an entity class defined something like this When this class is converted to JSON, the field gets converted to the following string representation I want to have the json response as yyyy-MM-dd. I tried the @DateTimeFormat(iso = ISO.DATE) annotation and that did not help either. Is there an easy way to do this

Running code after Spring Boot starts

I want to run code after my spring-boot app starts to monitor a directory for changes. I have tried running a new thread but the @Autowired services have not been set at that point. I have been able to find ApplicationPreparedEvent, which fires before the @Autowired annotations are set. Ideally I would like the event to fire once the application

How do I inject a logger into a field in the sample spring boot application?

What I want is to make spring autowire a logger. So, in other words, I want to have this working: Right now it throws an exception at startup: “No qualifying bean of type [org.slf4j.Logger] found for dependency…”. My pom.xml dependencies: I read this: http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-logging It says if you use one of the starter poms (I do) Logback is used –

Immutable @ConfigurationProperties

Is it possible to have immutable (final) fields with Spring Boot’s @ConfigurationProperties annotation? Example below Approaches I’ve tried so far: Creating a @Bean of the MyProps class with two constructors Providing two constructors: empty and with neededProperty argument The bean is created with new MyProps() Results in the field being null Using @ComponentScan and @Component to provide the MyProps bean.

Spring Boot with container security

I’ve been using spring boot for some projects lately and I really like it. For a new project, we’d like to use tomcat-users.xml for really basic authentication, but I can’t figure out how to use the mechanism without a web.xml file. Most people using spring boot seem to be using spring security. Is it possible to use tomcat container security

Advertisement