Skip to content
Advertisement

Tag: spring-boot

Spring boot app terminated at startup

I have created a spring boot project using spring initilizer. I use spring-boot-cli version v1.5.3.RELEASE. I just try to run: But my server won’t stay running, it is closing automatically. On port 8080 I have no other connection: LATER EDIT: Still not working. EDIT: here is the pom file: Answer I added in the pom file a tomcat dependency and

Accessing Spring RestApi using POSTMAN (404 not found)

I’m trying to access a simple api using POSTMAN but every time it give the error 404 not found. What can I do to access my api? This is my PostApi class, My main class is in BloggApplication.java. I call the API using POSTMAN as this, with body Answer I solved the issue I moved Application class which contains the

DispatcherServlet and web.xml in Spring Boot

I’m currently trying to move my project from Java EE to Spring Boot project. However, i’ve been stucked and confused on the part with dispatcher servlet and web.xml and it seems like web.xml is no longer being read by the project anymore. The current project is running on tomcat 7. In my web.xml file, I have lots of servlet, servlet-mapping,

Spring Boot application in eclipse, the Tomcat connector configured to listen on port XXXX failed to start

I’m developing a REST API using Spring Framework. First I wasn’t able to run my application because of the same problem. The port 8080 on my computer is busy. Then I found out that one alternative to solve this problem is creating an application.properties file under src/main/resources folder. That’s what I made, and set up the server to listen on

Thymeleaf cannot detect templates inside spring-boot project

I have the following project structure in my Spring boot app, in which I want to use Thymeleaf but the spring-boot cannot find my template directory and is showing warning Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration) PS: I am using @EnableAutoConfiguration In my controller code I am doing something like: and index.html

Return custom object from Spring Data with Native Query

My question is based on another post. How can I achieve the same with a native query? Native queries do not allow JPQL thus do not allow new instances either. My POJO. My database table contains coordinates for cities perimeter, so there are three columns: city_name, latitude, longitude. Each city contains lots (really, LOTS) of perimeter coordinates that will be

Spring Data Couchbase @CreatedDate not working

I’m using Spring boot with spring data couchbase. I’ve added two fields for createdDate and lastModifiedDate with @CreatedDate and @LastModifiedDate annotations in Movie Document. lastModifiedDate works great but createdDate is always null. I’ve also added a configuration for @EnableCouchbaseAuditing: Movie Repository: application.yml for reference: Answer As stated in the documentation, in order to distinguish between a creation and an update,

How to log time taken by Rest web service in Spring Boot?

I am writing a web Rest web service using Spring Boot. I want to log time taken by my webservice to process request. Also I want to log headers,method and URI called. I have done similar in my jersey web service few months back using ContainerRequestFilter and ContainerResponseFilter filter() method. Also, AOP is Better or Filter? Answer Have you tried

How to log errors in a EnvironmentPostProcessor execution

I have created an EnvironmentPostProcessor in SpringBoot to fetch properties from database and attached it to the Spring’s Environment as a PropertySource. This is the code I have: And this is the main/META-INF/spring-factories file had to be created: The code works well, it fetches from the db what I need. However, I would like to log information about this in

Advertisement