Spring MVC struktura katalogów w Intellij

0

Po wejściu na stronę http://localhost:8081/GreenLibrary/resorces/images/P1234.png dostaję 404
Jak powinienem skonfirurować DispatcherServlet-context.xml żeby mieść dostęp do zdjęć ?
Ewentualnie może mam jakiś problem w strukturze folderów ?

str.png

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
		http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">


    <mvc:annotation-driven enable-matrix-variables="true"/>
    <mvc:resources mapping="/resources/" location="resources/"/>
    <context:component-scan base-package="s10338" />

    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/views/" />
        <property name="suffix" value=".jsp" />
    </bean>

    <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
        <property name="persistenceUnitName" value="myDatabase" />
    </bean>

    <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
        <property name="basename" value="messages"/>
    </bean>

</beans>
0

Teoretycznie ten fragment powinien pomóc

<mvc:resources mapping="/resources/" location="/resources/**"/>

ale nie działa dalej jest 404 a idea krzyczy że can't resolve location

0

A gdzie powinno być META-INF i persistance.xml Bo teraz nie chce mi się zbudować bean
'entityManagerFactory' defined in ServletContext resource [/WEB-INF/DispatcherServlet-context.xml]
javax.persistence.PersistenceException: No Persistence provider for EntityManager named myDatabase

0

To zależy od tego jak tworzysz persistence context. Domyślnie plik jest w src/main/resources/META-INF/persistence.xml ale zauważ ze ja na przykład tworzę entity manger factory z poziomu springa w jego kontekscie więc mi ten dodatkowy plik konfiguracyjny nie jest po prostu potrzebny.

0

A ja polecę swoją apkę na wzór :)

https://github.com/DanielMichalski/spring-web-rss-channels

1 użytkowników online, w tym zalogowanych: 0, gości: 1