In the Spring Boot’s docs here, about serving static content, it says: By default Spring Boot will serve static content from a directory called /static (or /public or /resources or /META-INF/resources) in the classpath. I found that all the content in the directory: will be copied inside the classpath, so I can put my static content in: and all will
Tag: spring-mvc
spring combine two validation annotations in one
I’m using Spring+Hibernate+Spring-MVC. I want to define a custom constraint combining two other predefined validation annotations: @NotNull @Size like this: and I want to use this annotation in my form models. UserController.java But it does not work. It accepts the less than 4 character passwords. How can I solve this problem? Answer This is a bit late, but technique of
Spring – No EntityManager with actual transaction available for current thread – cannot reliably process ‘persist’ call
I get this error when trying to invoke “persist” method to save entity model to database in my Spring MVC web application. Can’t really find any post or page in internet that can relate to this particular error. It seems like something’s wrong with EntityManagerFactory bean but i’m fairly new to Spring programming so for me it seems like everything
Spring web mvc example, boot, Error creating bean with name ‘jacksonObjectMapperBuilder’
I’m new to Spring and largely to Java beyond the language itself…minimal console apps, etc. I’m trying to get the Spring website example here (https://spring.io/guides/gs/serving-web-content/) to work and I’m trying to stick with the spring boot piece used in the example rather than bailing and creating my own servlet class, etc. Using Netbeans 8 on OS X Yosemite. I’ve been
Not supported for DML operations with JPA update query
This has been asked once before but the solution did not solve the issue. I am creating a JUnit test: The query the above test is calling is: Error: Answer The @Modifying annotation must be placed on the updateMaterialInventory method, along to the @Query annotation, to let Spring-data know that the query is not a query used to select values,
Spring Rest Controller Return Specific Fields
I’ve been going through my head the best way to design a JSON API using Spring MVC. As we all know IO is expensive, and thus I don’t want to make the client make several API calls to get what they need. However at the same time I don’t necessarily want to return the kitchen sink. As an example I
Spring Boot Actuator without Spring Boot
I’ve been working on a Spring/Spring MVC application and I’m looking to add performance metrics. I’ve come across Spring Boot Actuator and it looks like a great solution. However my application is not a Spring Boot application. My application is running in a traditional container Tomcat 8. I added the following dependencies I created the following config class. I even
How to understand Spring @ComponentScan
I’m following a tutorial about Spring MVC and I cannot understand something about the @ComponentScan annotation even after reading the spring API doc, so here is the sample code: Configuring View Controllers Annotation-based Controllers My question is, for View Controllers, by adding @Configuration and @ComponentScan(basePackages = { “com.apress.prospringmvc.bookstore.web” }), what will be done in the background? Will the package com.apress.prospringmvc.bookstore.web
Spring JPA no transaction is in progress
I am new to Spring and JPA, wasted 5 days and no result with searching internet. I want to save object to SQL SERVER, connection is correct but when I write .flush() I get the exception nested exception is javax.persistence.TransactionRequiredException: no transaction is in progress This is my jpaContext.xml This is my persistence.xml file: This is my Service implementation: And
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