spring-mvc

Serve dynamically changing static content with Spring Boot

廉价感情. 提交于 2021-01-27 07:10:40
问题 Right now I have a simple Spring Boot application that serves static images that I have placed in resources/static/img . This works just fine for displaying the actual content, but there are two things I'd like to fix: I don't want any of these images to be bundled with the resulting .jar file, and I know that placing these images in the resources folder will do that. Using my current setup, in order to see a new image on the webapp, I have to add it to the folder and restart it. I would

Spring - Thymeleaf - Tomcat -> can not process UTF-8 character correctly

扶醉桌前 提交于 2021-01-27 06:52:41
问题 I am trying to display UTF-8 character in Spring-MVC web page. utf-8 values are coming from the database. I have already converted my database into utf-8. web services I have written is displaying the values as expected but, in the web page it is not showing the correct value. below is my spring configuration, please let me know what I am doing wrong. I am using thymeleaf as a templating engine: Thymeleafe configuration: <bean id="templateResolver" class="org.thymeleaf.templateresolver

Spring - Thymeleaf - Tomcat -> can not process UTF-8 character correctly

家住魔仙堡 提交于 2021-01-27 06:51:09
问题 I am trying to display UTF-8 character in Spring-MVC web page. utf-8 values are coming from the database. I have already converted my database into utf-8. web services I have written is displaying the values as expected but, in the web page it is not showing the correct value. below is my spring configuration, please let me know what I am doing wrong. I am using thymeleaf as a templating engine: Thymeleafe configuration: <bean id="templateResolver" class="org.thymeleaf.templateresolver

No property index found for type User

拟墨画扇 提交于 2021-01-27 06:03:40
问题 I'm trying to use ElasticSearch with MySQL in the same project. I defined two repositories in different project but I always get this error message: Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.owish.services.UserServices com.owish.controllers

Configure Swagger-UI to pick up Spring's HttpSecurity Logout endpoint

岁酱吖の 提交于 2021-01-27 05:52:49
问题 I have Swagger set up and working for all of the controllers listed in my application. However, I want it to pick up the Spring Security Logout Endpoint and I cannot find a way to get it to work. As you can see from code snippet below I am specifying a logoutUrl for a user to invalidate their session. I've tried class level annotation markings and method level, but no luck. Any ideas? @Override public void configure(HttpSecurity http) throws Exception { http.addFilter(someFilter()); http

Orika ClassCastException in Spring Boot webapp

牧云@^-^@ 提交于 2021-01-27 04:17:08
问题 I'm having a weird ClassCastException while mapping an entity to a DTO with Orika in a sample Spring Boot webapp I'm working on. I get the exception when I attempt to do the mapping on the deployed app in embedded Tomcat, but I can do the mapping just fine in a JUnit test context. This are the relevant classes (they are all very simple): JPA entity: @Entity public class Position { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; private String name; // getters

Orika ClassCastException in Spring Boot webapp

こ雲淡風輕ζ 提交于 2021-01-27 04:16:12
问题 I'm having a weird ClassCastException while mapping an entity to a DTO with Orika in a sample Spring Boot webapp I'm working on. I get the exception when I attempt to do the mapping on the deployed app in embedded Tomcat, but I can do the mapping just fine in a JUnit test context. This are the relevant classes (they are all very simple): JPA entity: @Entity public class Position { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; private String name; // getters

class required a single bean, but 2 were found:

梦想与她 提交于 2021-01-26 21:35:15
问题 I have the below interface: public interface MailSender { void sender(String to, String subject,String body); } With 2 imlementation of it: public class SmtpkMailSender implements MailSender { static Log log=LogFactory.getLog(MailSender.class); public void sender(String to, String subject,String body){ log.info("SMTP To: "+to); log.info("SMTP Subjecy: "+subject); log.info("SMTP body: "+body); } } and the second one is: @Primary public class MockMailSender implements MailSender { static Log

Attribute 'local' is not allowed to appear in element 'ref' in Spring 4.1.5

本秂侑毒 提交于 2021-01-26 11:24:14
问题 I am currently going through Mkyong Spring 3.0 tutorial. He goes on to clarify these 2 basic things. 1. Bean in different XML files If you are referring to a bean in different XML file, you can reference it with a ‘ref‘ tag, ‘bean‘ attribute. 2. Bean in same XML file If you are referring to a bean in same XML file, you can reference it with ‘ref‘ tag, ‘local‘ attribute. The only thing I can make out is that the local attribute is not supported any more in version 4.1. 5. For the timebeing, I

Attribute 'local' is not allowed to appear in element 'ref' in Spring 4.1.5

ぐ巨炮叔叔 提交于 2021-01-26 11:21:31
问题 I am currently going through Mkyong Spring 3.0 tutorial. He goes on to clarify these 2 basic things. 1. Bean in different XML files If you are referring to a bean in different XML file, you can reference it with a ‘ref‘ tag, ‘bean‘ attribute. 2. Bean in same XML file If you are referring to a bean in same XML file, you can reference it with ‘ref‘ tag, ‘local‘ attribute. The only thing I can make out is that the local attribute is not supported any more in version 4.1. 5. For the timebeing, I